Darkster Posted September 2, 2014 Share Posted September 2, 2014 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) self.SetSizer(sizer_test) self.Layout() def evt_test(self, event): print "Click" def runWxApp(app, window): def processWxEvents(): while event_loop.Pending(): event_loop.Dispatch() app.ProcessPendingEvents() def onClose(event): window.Show(False) window.Destroy() processWxEvents() hou.ui.removeEventLoopCallback(processWxEvents) window.Bind(wx.EVT_CLOSE, onClose) event_loop = wx.EventLoop() wx.EventLoop.SetActive(event_loop) hou.ui.addEventLoopCallback(processWxEvents) app = wx.PySimpleApp() frame = testFrame(None, wx.ID_ANY, "testFrame") frame.Show() runWxApp(app, frame) I'm running Linux Centos 6 & Houdini 13.0.376 Any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted September 4, 2014 Share Posted September 4, 2014 (edited) 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 September 4, 2014 by Stalkerx777 Quote Link to comment Share on other sites More sharing options...
Darkster Posted September 9, 2014 Author Share Posted September 9, 2014 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.