Read data from Entry : Entry « Tkinker « Python Tutorial






Read data from Entry
from Tkinter import *
from math import *
def calc():
    result = "= " + str(eval(expression.get()))
    label.config(text = result)

root = Tk()
frame = Frame(root)
label = Label(frame)
entry = Entry(frame)
expression = StringVar()
entry["textvariable"] = expression 
button = Button(frame, text = "=", command = calc)
frame.pack()
entry.pack()
label.pack(side=LEFT)
button.pack(side=RIGHT)
frame.mainloop()








18.11.Entry
18.11.1.Read data from EntryRead data from Entry
18.11.2.Create a story based on user inputCreate a story based on user input
18.11.3.Working with Entry Fields and Grid LayoutsWorking with Entry Fields and Grid Layouts
18.11.4.Text WidgetsText Widgets