The code (2)

s = StringVar()  # variable to be attached to widgets
def comp_s():
   global s
   s.set('%g' % math.sin(float(r.get())))  # construct string

compute = Button(top, text=' equals ', command=comp_s)
compute.pack(side='left')

s_label = Label(top, textvariable=s, width=18)
s_label.pack(side='left')

root.mainloop()

previousnexttable of contents