问题描述:

is there any way how to force to update main frame? I just need this:

if(saved(0)):

Tk.Button(self.frame, text="Continue", command=self.pokracovat, relief="groove").grid()

First, I open main window. Function "saved" returns false, so button is not created. Then i open some another window using toplevel. Main window is vanished. Then I close that window and open main window - function "saved" now returns true, but still button doesnt appear. I use self.root.update(), but it doesnt work.

网友答案:

To create a button when saved changes to True you can do the following:

  1. You can use a loop that checks for the value and when the value changes then the loop does something. tkinter loop and serial write
  2. you know where the value is changed and at this positions you insert some code that does what you want. For this the observer pattern can be interesing.
相关阅读:
Top