A kind of calculator

Label + entry + label + entry + button + label

# f_widget, x_widget are text entry widgets

f_txt = f_widget.get()  # get function expression as string
x = float(x_widget.get())   # get x as float
#####
res = eval(f_txt) # turn f_txt expression into Python code
#####
label.configure(text='%g' % res) # display f(x)

previousnexttable of contents