Threaded splash screen with XRC

41 views
Skip to first unread message

redxine

unread,
May 2, 2012, 3:03:16 PM5/2/12
to wxpytho...@googlegroups.com
I've gotten the loading time for my program up to nearly 8 seconds and saw it fit to add a splash screen.  I've already looked at http://wiki.wxpython.org/SplashScreen and have a working splash instance, and used the info from http://wiki.wxpython.org/LongRunningTasks to decide to place the entire panel into a new thread while my program initializes.

From what I can tell the splash screen works fine, and the threading works as expected, passing control back so I can do my app = MyApp(False), however the whole thing goes downhill in MyApp.OnInit when I load the XRC resources with xrc.XmlResource().  The error itself is actually different every time, and sometimes it just hangs, so I'm completely lost here.

python: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.0.
python: Fatal IO error 2 (No such file or directory) on X server :0.0.
 
- and sometimes a generic X error message (I don't have X11 debugging turned on).

And the files in question are gui.py and splash.py.

I've never tried anything involving threading before so any pointers as to what I'm doing wrong would be greatly appreciated.
 
 

Robin Dunn

unread,
May 2, 2012, 3:10:45 PM5/2/12
to wxpytho...@googlegroups.com
On 5/2/12 12:03 PM, redxine wrote:
> I've gotten the loading time for my program up to nearly 8 seconds and
> saw it fit to add a splash screen. I've already looked at
> http://wiki.wxpython.org/SplashScreen and have a working splash
> instance, and used the info from
> http://wiki.wxpython.org/LongRunningTasks to decide to place the entire
> panel into a new thread while my program initializes.
>
> From what I can tell the splash screen works fine, and the threading
> works as expected, passing control back so I can do my app =
> MyApp(False), however the whole thing goes downhill in MyApp.OnInit when
> I load the XRC resources with xrc.XmlResource(). The error itself is
> actually different every time, and sometimes it just hangs, so I'm
> completely lost here.
>
> python: Fatal IO error 11 (Resource temporarily unavailable) on X
> server :0.0.
>
> python: Fatal IO error 2 (No such file or directory) on X server :0.0.
>
> - and sometimes a generic X error message (I don't have X11 debugging
> turned on).
>
> My code's on github: https://github.com/jkltechinc/Taxidi/tree/experimental
> And the files in question are *gui.py *and *splash.py*.
>
> I've never tried anything involving threading before so any pointers as
> to what I'm doing wrong would be greatly appreciated.

You can only create or manipulate UI objects from the GUI thread. You
also can not have more than one instance of wx.App to try and have
multiple GUI threads.

--
Robin Dunn
Software Craftsman
http://wxPython.org

Reply all
Reply to author
Forward
0 new messages