CSSE1001 / MyPyTutor

Interactive tutorial application for Python3.
Other
7 stars 12 forks source link

Error on start-up #113

Closed mijohen closed 9 years ago

mijohen commented 9 years ago

If I start MyPyTutor and then drag another window around while its loading I get an error when it finally appears.

mijohen commented 9 years ago

Exception in Tkinter callback Traceback (most recent call last): File "/usr/lib/python3.4/tkinter/init.py", line 1536, in call return self.func(_args) File "/usr/lib/python3.4/tkinter/init.py", line 585, in callit func(_args) File "/home/michael/Documents/Github/MyPyTutor/code/tutorlib/gui/app/app.py", line 549, in login logged_in = self.web_api.login() File "/home/michael/Documents/Github/MyPyTutor/code/tutorlib/interface/web_api.py", line 119, in login success = self.session_manager.login(username, password) File "/home/michael/Documents/Github/MyPyTutor/code/tutorlib/online/session.py", line 155, in login LoginDialog(None, submit_login) File "/home/michael/Documents/Github/MyPyTutor/code/tutorlib/gui/dialogs/login.py", line 35, in init super().init(parent, title, allow_cancel=True) File "/home/michael/Documents/Github/MyPyTutor/code/tutorlib/gui/dialogs/dialog.py", line 21, in init self.grab_set() File "/usr/lib/python3.4/tkinter/init.py", line 674, in grab_set self.tk.call('grab', 'set', self._w) _tkinter.TclError: grab failed: another application has grab

sapi commented 9 years ago

I can't reproduce this on OS X, which suggests to me it might be an issue with Tcl for Linux.

I'd be inclined to view it as a tkinter error; attempting to make a window modal (which is what .grab_set is for) shouldn't fail just because an application happens to be backgrounded.

Wrapping the call to .grab_set in a try/except isn't ideal, as it would mean that the dialog was no longer modal (which would be very unexpected for the app). An alternative would be to call .force_focus, but as the documentation says, that's rude.

Thanks for the report, but unless this is an issue on Windows, or unless you can think of a nicer fix, I don't think it will be worth dealing with.