My application: "starting window" with some misc. buttons etc. & server socket connection is running at the same time in a new thread.
When connection is made, the starting windows is closed and the main window will be opened.
Problem: I can't close the starting window which is Toplevel window, if I try to withdraw or destroy it, the application freeze.
I'm quite newbie so please try to answer as clearly as possible =)
When connection is made, the starting windows is closed and the main window will be opened.
Problem: I can't close the starting window which is Toplevel window, if I try to withdraw or destroy it, the application freeze.
I'm quite newbie so please try to answer as clearly as possible =)
Code:
from Tkinter import * import threading master = Tk() #make the main window and hide it master.minsize(width=300, height=300) master.withdraw() class first_window(): def __init__(self): global start_window def thread_is_finished(self): main_app() #CONNECTION is made, start main application window # start_window.withdraw() #APPLICATION HANGS IF I TRY TO HIDE THIS?!? # start_window.destroy() #DESTROY DOESN'T WORK EITHER :( start_window = Toplevel() #show the starting window start_window.minsize ( width=150, height=150 ) start_window.bind("<<foo>>",thread_is_finished) master.update() #update (bind will be "saved") server_start().start() #start the server in a new thread class main_app(): def __init__(self): master.deiconify() #show the main window class server_start ( threading.Thread ): def run (self): global start_window #...here's the server socket code... start_window.event_generate("<<foo>>") #when finished generate event master.after_idle(first_window) #after mainloop start first_window master.mainloop()
Comment