[Tutor] Fw: I want to display Integral symbols

edmundo pierre edmundopierre at yahoo.com
Wed Sep 6 03:09:14 EDT 2017


So show us what you did. Its hard to figure out what's
gone wrong when we can't see your code:That is what I did:
from sympy import*from tkinter import*from sympy import init_printing
root = Tk()root.geometry("450x350+500+500")root.title("Factorisations/Simplifications")root.configure(background = "gray")#Difine variablevar1= StringVar()var2 =StringVar()#Create the function answer
def Answer():    x = symbols("x")    A = var1.get()    B = factor(A)    Right_insert_top .insert(END,str(B))

    #A1 = var2.get()    #B1 = factor(A1)    #Right_insert_top .insert(END,str(B1))#Create the function simplification
def Simplification():    init_printing()    x= symbols("x")    D = var2.get()    E = expand(D)    Right_insert_top .insert(END,str((E))     #Create the Factorisation frameTops = Frame(root,relief= "sunken")Tops.pack(side = TOP)
#Create a Label of the TopTop_Label = Label(Tops,font=("arial",30,"bold"),text = "Factorisations/Simplifications",bd = 10)Top_Label.pack(side = "top",fill =BOTH )
#Create the left frameLeft = Frame(root,relief= "sunken")Left.pack(side = "left",fill =BOTH )
#Create the top left frameTop_left = Frame(Left,relief= "sunken")Top_left.pack(side ="top")
#Create the Labels top and bottomLeft_top = Label(Top_left ,text ="Factorise: ",bd = 5)Left_top.pack(side= "left",fill =BOTH)
top_entry = Entry(Top_left,textvariable = var1,bd = 5)top_entry.pack(side= "right",fill =X)
#Create the bottom leftLeft_bottom = Frame(Left,relief= "sunken")Left_bottom.pack(side = "bottom",fill =BOTH )

Left_bottom_label = Label(Left_bottom,text ="Simplifie: ",bd = 5)Left_bottom_label.pack(side= "left")
bottom_entry = Entry(Left_bottom ,textvariable = var2,bd = 5)bottom_entry.pack(side= "right",fill =X)
#Create a Right side Frame
Right = Frame (root,relief= "sunken")Right.pack(side = "right",fill = BOTH)
#Create a Frame on the Top rightRight_top = Frame (Right,relief= "sunken")Right_top.pack(side = "top")
#Create the bottom frame on the rightRight_bottom = Frame (Right,relief= "sunken")Right_bottom.pack(side = "bottom")#Create a insert text on the screen on the rightRight_insert_top = Text( Right_top,font=("arial",10,"bold"),bd= 5)Right_insert_top.pack()
#Create the exit bottom#Right_exit_buton = Button(Right_bottom1 , text = "Exit", font=("arial",20,"bold"),bd = 5)#Right_exit_buton.pack(side ="right")
#Create the Reset bottomRight_reset_buton = Button(Right_bottom , text = "Answer\nSimplifie ",command = Simplification,  font=("arial",20,"bold"),bd = 5)Right_reset_buton.pack(side ="right")#Create the Answer buttonRight_answer_buton = Button(Right_bottom , text = "Answer\nFactorisasions",command= Answer, font=("arial",20,"bold"),bd = 5)Right_answer_buton.pack(side ="left")
root.mainloop()



I am using Window 7. I have two  functions: Factorization and Simplification. I am using Tkinter (GUI). When I entered the polynomial :(x+3)**2 at the simplify box and when I clicked ANSWER SIMPLIFY, I got: x**2+6*x+9, which is Correct. But I do not like the syntax. I will like my syntax to be clear like this in my Tkinter:  (x−3)2      x-32x-32  and the answer to be like this: x2+6x+9I am trying to display the answer : 
x2−6x+9on the Tkinter screen I created. I am using Python 3.6.1. I used the Integral as an example of how my answer should look like. My code run perfectly, you can try. Thank you!


More information about the Tutor mailing list