Reset GUI Main Window

I just need the equivalent of closing and reopening my main program. I want to call it when they click on the "new" option from the drop-down menu. Something like calling root.destroy () and then rerunning mainloop.

How can i do this?

+3
source share
3 answers

You can take all the GUI building logic and state source code from mainloop and include it in functions. Call these functions from mainloop (something like: buildgui () and initstate ()), and then when the user clicks your menu icon, just call initstate () to return it, as it was when you first started the application.

+1

.

: . , . , . , .

: nuke pave. , . , , , reset ( ), , .

: , ... , , .

(dis?) . , , .. .

+3

If you are running Unix, restart the entire application using os.execv. Make sure you pass all the command line arguments, etc.

+2
source

Source: https://habr.com/ru/post/1706143/


All Articles