Aug-05-2018, 09:10 PM
You never going to be able to print anything in the main area.
Program must run first. Then when program ends. All widgets are destroyed. All this happens when mainloop is called.
Example
Program must run first. Then when program ends. All widgets are destroyed. All this happens when mainloop is called.
Example
import Tkinter as tk class Main: root = tk.Tk() value = "None" class Menu: def __init__(self, master): self.master = master self.entry = tk.Entry(self.master) self.entry.pack(side=tk.TOP) self.button = tk.Button(master,text='Hit Me',command = self.get_value) self.button.pack(side=tk.TOP) self.button_send = tk.Button(master, text="Get Text", command=self.get_text) self.button_send.pack() self.label = tk.Label(master, text=Main.value) self.label.pack() def get_value(self): Main.value = self.entry.get() def get_text(self): #self.label['text'] = self.entry.get() self.label['text'] = Main.value if __name__=="__main__": Main.menu = Menu(Main.root) Main.root.mainloop()
99 percent of computer problems exists between chair and keyboard.