from tkinter import * root=Tk() root.geometry( "300x520" ) root.title( "Calculator by Elalita" ) scvalue=StringVar() scvalue.set( " " ) screen=Entry(root, textvar =scvalue, font = "lucida 40 bold" ) screen.pack( fill =X, ipadx = 8 , padx = 10 , pady = 10 ) def click ( event ): global scvalue text=event.widget.cget( "text" ) print (text) if text== "=" : if scvalue.get().isdigit(): vlaue= int (scvalue.get()) else : try : value= eval (screen.get()) ...
Comments