I went thru pumpThread.py, and it helped. Thnx man! Gr8
But in this case, cant we use Maya commands, say to open new file in current Maya? ( mc.file(f=True,new=True) )
See below code:
import wx, threading
import maya.cmds as mc
newThread = None
app = None
class MyApp(wx.Frame):
def __init__(self, parent, id, txt):
wx.Frame.__init__(self, parent, id, txt)
wx.Button(self)
self.Show(True)
self.Bind(wx.EVT_BUTTON, self.OnClick)
def OnClick(self, evt):
mc.file(f=True,new=True)
def mainFn():
global app
app = wx.App()
MyApp(None, -1, 'Hello')
app.MainLoop()
def initializeNewThread():
global newThread
global app
if newThread == None:
newThread = threading.Thread( target = mainFn, args = () )
newThread.start()
initializeNewThread()
Error when click button.
Plz help.