Jump to content

wxPython Crashes with multiple instances

Recommended Posts

Hi guys,
When I try to run a wxpython GUI (like the one below) it crashes Houdini if I run it twice without closing the original.
I'm using the method described in the docs to run it in a separate thread so it doesn't lock up Houdini. I've tried using a  wx.SingleInstanceChecker(), but I'm not sure how to properly integrate it into my scripts.


Has anyone encountered this problem before and/or have any solutions?
Test code:

import wx

class testFrame(wx.Frame):
    def __init__(self, *args, **kwds):
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.button_test = wx.Button(self, wx.ID_ANY, "Click me!")
        self.SetTitle("Crashing Test Frame")
        self.SetSize((100, 100))

        self.Bind(wx.EVT_BUTTON, self.evt_test, self.button_test)
        sizer_test = wx.BoxSizer(wx.VERTICAL)
        sizer_test.Add(self.button_test, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL | wx.ADJUST_MINSIZE, 20)

    def evt_test(self, event):
        print "Click"

def runWxApp(app, window):

    def processWxEvents():
        while event_loop.Pending():

    def onClose(event):
    window.Bind(wx.EVT_CLOSE, onClose)

    event_loop = wx.EventLoop()

app = wx.PySimpleApp()
frame = testFrame(None, wx.ID_ANY, "testFrame")
runWxApp(app, frame)


I'm running Linux Centos 6 & Houdini 13.0.376


Any help would be appreciated.

Share this post

Link to post
Share on other sites

Some time ago i'he been using wxPython. Haven't any problem with that. I'l try your code on my machine.


UP. Yes, it hangs in case of multiple instances. I think i't possible to fix, i'l check it out later.

Edited by Stalkerx777

Share this post

Link to post
Share on other sites

Thanks for taking a look.


At the moment it's not much of a issue, it's just very annoying when it happens. Normally I force the GUI window to always stay on top, so this issue is normally not a problem, but it's easy to forget you have a GUI open if it's minimized or you don't have always.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now