Hi to everybody,
here is a sample, without my code that lies in another module, but with Mike’s loop
to simulate the routine:
#!/usr/bin/python
-- coding: cp1252 --
import wx
import wx.html
class Janela(wx.Frame):
def init(self):
wx.Frame.init(self, None, -1, “Recovery 1.0”, size=(800, 600), pos=(400,250))
panel = wx.Panel(self, -1)
ini = 132
tam = 800 - ini
self.edtPathSource = wx.TextCtrl(panel,-1,"",size=(tam,32),pos=(ini,1),style=wx.TE_READONLY|wx.TE_LEFT)
self.edtPathTarget = wx.TextCtrl(panel,-1,"",size=(tam,32),pos=(ini,64),style=wx.TE_READONLY|wx.TE_LEFT)
self.btnPathSource = wx.Button(panel,-1,label="Source", pos=(ini,32), size=(tam,32))
self.btnPathTarget = wx.Button(panel,-1,label="Target", pos=(ini,96), size=(tam,32))
self.btnAnalisa = wx.Button(panel,-1,label="Waiting 4 input", pos=(ini,160), size=(tam,32))
self.btnExit = wx.Button(panel,-1,label="Exit", pos=(ini,192), size=(tam,32))
self.lstDatas = wx.ListBox(panel,-1,(1,1),(ini,599),['Empty'],wx.LB_SINGLE)
self.Bind(wx.EVT_BUTTON,self.OnClickPathSource, self.btnPathSource)
self.Bind(wx.EVT_BUTTON,self.OnClickExit, self.btnExit)
self.Bind(wx.EVT_BUTTON,self.OnClickAnalisa, self.btnAnalisa)
self.Bind(wx.EVT_BUTTON,self.OnClickPathTarget, self.btnPathTarget)
def OnClickPathSource(self, event):
print 'Dialog'
def OnClickPathTarget(self, event):
print 'dialog'
def OnClickExit(self, event):
exit()
def OnClickAnalisa(self, event):
self.btnAnalisa.SetLabel('Working')
self.btnAnalisa.Refresh()
self.lstDatas.Clear()
for x in range(5):
print "sleep"
wx.Sleep(1)
print "awake!"
if name == ‘main’:
app = wx.PySimpleApp()
frame = Janela()
frame.Show(True)
app.MainLoop()
Thank you.
···
On Sat, Jan 31, 2009 at 10:55 PM, Robin Dunn robin@alldunn.com wrote:
Cody Precord wrote:
Or if that fails try calling Yield to let the main loop have a chance to process pending events before going into your routine.
Or don’t block returning to the main loop and do your long running task in some other way.
http://wiki.wxpython.org/LongRunningTasks
http://wiki.wxpython.org/Non-Blocking_Gui
–
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users