Python Tkinter freezes when trying to connect to server

Viewed 32

I'm trying to make a GUI for client/server but I'm stuck on this part. When I try to execute code in the "except" part to handle a failed attempt to connect to the server the shell just freezes. What's wrong?

def gameLoop():
    try:
        client.connect(ADDR)
    except:
        #Application freezes executing this
        errorLabel = tk.Label(root, text='Failed to connect. Retry?')
        errorLabel.place(x=200, y=20)

#Build the Canvas, redacted for length
connectButton = tk.Button(root, text='Connect', width='10', height='1', command=gameLoop)
connectButton.place(x=50, y=70)
root.mainloop()

0 Answers
Related