Tkinter buttons/functions | Sololearn: Learn to code for FREE!


Tkinter buttons/functions

Is is possible to create a button or fucntion with two commands one to open a new window and to close the previous window. E.g. a login page, once you login a new page is opened and the previous page is gone I’m able to open a new window but not sure how to tell the program to close the previous window.

4/9/2019 6:36:58 PM

farhan bhatti

1 Answer

New Answer


Hm well you could make two classes and when you click on a button one window is closed while the init method of the other class is being called. If you want to close a window you can use root.destroy() or sys.exit(0) to quit the script.