Tkinter buttons/functions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

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.

9th Apr 2019, 6:36 PM
farhan bhatti
farhan bhatti - avatar
1 Answer
0
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.
9th Apr 2019, 11:30 PM
gabrijel2503