[SciPy-dev] gui_thread issue

Pearu Peterson pearu at scipy.org
Thu Nov 4 17:02:45 CST 2004



On Thu, 4 Nov 2004, Fernando Perez wrote:

> Peter Wang schrieb:
>> Hey guys,
>> 
>> I'm running into a problem with gui_thread on wxPython 2.4.1.2 and python 
>> 2.3.4 running on win32.  The following lines will crash the interpreter, 
>> ipython, or PythonWin (although IDLE seems to survive with a big "RESTART" 
>> line):
>> 
>>  >>> from gui_thread import examples
>>  >>> examples.non_modal_sample()
>> 
>> This appears to be the case with both the gui_thread that ships with the 
>> latest Enthought distribution as well as the latest version from CVS.
>> 
>> Any ideas?  Is this a known issue?
>
> It may have something to do with win32. Under Fedora Core 2, with python 
> 2.3.3 and wX 2.4.2.4, this is what I get (in ipython):
>
> n [1]: from gui_thread import examples
>
> In [2]: examples.non_modal_sample()
> Out[2]: <gui_thread.examples.SimpleFrame instance; proxy of C++ wxFrame 
> instance at _9973098_wxFrame_p>
>
> In [3]:
>
> No window pops up, so I'm not sure if that's the expected behavior.

This is expected. You have to do gui_thread.start() first.

>  However, if I try to start gui_thread first, I do get bizarre 
> behaviour:
>
> In [1]: import gui_thread
>
> In [2]: gui_thread.start()
>
> In [3]: gui_thread.examples.non_modal_sample()
> ---------------------------------------------------------------------------
> AttributeError                            Traceback (most recent call last)
>
> /home/fperez/<console>
>
> AttributeError: 'module' object has no attribute 'examples'

This one is expected behavior as well. Note that gui_thread/__init__.py 
does not import gui_thread/examples.py.

> In [4]: from gui_thread import examples
> ---------------------------------------------------------------------------
> AttributeError                            Traceback (most recent call last)
>
> /home/fperez/<console>
>
> /home/fperez/gui_thread/examples.py
>
> /home/fperez/gui_thread/examples.py in SimpleFrame()
>
> /usr/lib/python2.3/site-packages/wxPython/misc.py in __init__(self, *_args, 
> **_kwargs)
>    102 class wxSize(wxSizePtr):
>    103     def __init__(self,*_args,**_kwargs):
> --> 104         self.this = miscc.new_wxSize(*_args,**_kwargs)
>    105         self.thisown = 1
>    106
>
> /home/fperez/<string> in new_wxSize(*args, **kws)
>
> AttributeError: AttrHolder instance has no attribute 'result'

I don't get this error. Subsequent

In [5]: examples.non_modal_sample()

works fine: a window with 'Close Me' button appears.

I am using wxPython.__version__ == '2.4.2.4' on a Debian Sid box and 
Python 2.3.4.

Pearu




More information about the Scipy-dev mailing list