Who's on First, IDLE or pythonWin? Dialog Problem?

Steve Holden steve at holdenweb.com
Wed Feb 11 14:51:50 EST 2009


W. eWatson wrote:
> Steve Holden wrote:
>> W. eWatson wrote:
>>> My program in IDLE bombed with:
>>> ==============
>>> Exception in Tkinter callback
>>> Traceback (most recent call last):
>>>   File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__
>>>     return self.func(*args)
>>>   File
>>> "C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py",
>>>
>>> line 552, in OperationalSettings
>>>     dialog = OperationalSettingsDialog( self.master, set_loc_dict )
>>>   File
>>> "C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py",
>>>
>>> line 81, in __init__
>>>     tkSimpleDialog.Dialog.__init__(self, parent)
>>>   File "C:\Python25\lib\lib-tk\tkSimpleDialog.py", line 69, in __init__
>>>     self.wait_visibility() # window needs to be visible for the grab
>>>   File "C:\Python25\lib\lib-tk\Tkinter.py", line 415, in wait_visibility
>>>     self.tk.call('tkwait', 'visibility', window._w)
>>> TclError: window ".34672232" was deleted before its visibility changed
>>> ===============
>>> It runs fine in pythonWin performing the same entry operation. Open a
>>> menu,  select an item to open a dialog, select a select button in the
>>> dialog, press OK to leave the dialog. Boom, as above.
>>>
>>> (This does not mean pythonWin doesn't have problems of its own. ) If I
>>> just execute the code (double click on the py file, the console shows no
>>> problems. IDLE is unhappy.
>>>
>>> Another side to this is that I use WinMerge to find differences between
>>> my last saved copy and the current copy. I found the current copy had
>>> two lines where a abc.get() was changed to abc.get. This was undoubtedly
>>> from briefly using the pyWin editor, when I mis-hit some keys. Yet pyWin
>>> had no trouble executing the program. My guess is that while briefly
>>> editing there, I hit some odd combination of keys that produced,
>>> perhaps, an invisible character that pyWin ignores.
>>>
>>> Not the 34672232 window is a dialog that I closed by pressing OK. I
>>> would again guess, that, if there is a problem, it occurs in the code
>>> that destroys the dialog.
>>>
>>>
>> Well you have to remember that you are trying to run a windowed GUI
>> under the control of another windows GUI, so it isn't surprising that
>> you hit trouble.
>>
>> With IDLE the issue will be that IDLE already created a main window
>> before your program started running. With PythonWin you are using two
>> different toolkits, so it isn't really surprising that breaks down -
>> there will be two entirely separate main loops competing with each other.
>>
> Not quite. I take down IDLE when I run pyWin, and vice versa.
> 
The two separate loops being PyWin (which uses MFC) and your program
(which uses Tkinter). You just can't mix GUIs in the same process like
that, sorry.

regards
 Stedve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list