This is my first experience with Python's Tkinter GUI. I want to write a program where the result of an interim calculation is displayed on a label. Later in the program I want to use this result in another calculation by simply clicking on the label.
This is what I have set up for a test:
from Tkinter import *
root = Tk()
label1 = Label(root, text='')
label1.pack(side=TOP)
# do some caculation and format result
pi_approx = 355/113.0
str1 = "%.4f" % (pi_approx) # 3.1416
# show result in label text
label1.config(text=str1)
# more code here
mainloop()
I can bind the label to a mouse click, but can't figure out how to retrieve the label's content. Any advice how to do this? There must be some Tk mavens out there.