On 11/2/07, tarun <[EMAIL PROTECTED]> wrote: > > Dear All, > > I've have created a GUI (using wxPython widgets) where in I've a message > log window (A TextCtrl window). I've a router.dll that helps me putting in > message onto a channel. In my script that generates the GUI, I want to > continuously poll the channel and populate the messages from the channel to > the message log window. > > For this I've to put a while (1) loop, but when I do this, the GUI > doesn't come up. I see the GUI coming when while(1) is removed. Is there any > issue with usage of app.mainloop and while(1) together. > > Quick help would be really appreciated. > > > Hi Tarun,
The best practice to poll things in any GUI application is to use timers provided by the GUI frameworks. All of the GUI frameworks does provide timers, so does wxPython. Look for wx.Timer (also look for wx.CallAfter ) and use it to poll what ever the things you want http://www.wxpython.org/docs/api/wx.Timer-class.html When you use a while(1) loop, the python interpreter enters into an infinite local loop thus GUI events never gets processed. So your case seems be that, the while loop is getting executed before GUI is drawn on screen, it will never show up till the loop exits. And if while(1) is executed after GUI is drawn on screen, it will hangup and will not get updated till the loop exits. So avoid using while loops in your GUI for polling long running tasks . -- Godson Gera, http://godson.auroinfo.com http://godson.in -- Godson Gera, http://godson.auroinfo.com
-- http://mail.python.org/mailman/listinfo/python-list