On 12/24/06, Jérôme VUARAND <[EMAIL PROTECTED]> wrote: > 2006/12/24, John Labenski <[EMAIL PROTECTED]>: > > On 12/24/06, Jérôme VUARAND <[EMAIL PROTECTED]> wrote: > > > 2006/12/24, John Labenski <[EMAIL PROTECTED]>: > > > > What you're suggesting is not normal, it's better to have the system's > > > > native mainloop control program flow rather than implementing your own > > > > which will most likely be far less efficient. In any case you should > > > > be able to do it using wxApp::Pending and wxApp::Dispatch. > > > > > > wxApp::Pending+wxApp::Dispatch seems to be exactly what I need. > > > > You may still want to consider using wxEVT_IDLE though since I think > > that's what is typically suggested on the C++ wxusers mailing list for > > doing pseudo-threading like this. > > I've tried Pending+Dispatch but that don't seems to work. > wx.wxGetApp():Pending() never returns true. > > The code is : > wx = require("wx") > dofile(...) > local use_custom_loop = true > if use_custom_loop then > while true do while wx.wxGetApp():Pending() do > wx.wxGetApp():Dispatch() > end
wx.wxMilliSleep(10) -- adjust as necessary wx.wxGetApp():ProcessIdle() > end > else > wx.wxGetApp():MainLoop() > end > > The command line is : > lua bootstrap.lua minimal.wx.lua > > Everything works ok if I set my use_custom_loop to false. I'll have a > look at the internals of MainLoop to see what may be missing. And I > still need to try the idle event model, though I don't think that will > match my timing requirement. I can't test the changes above right now, but take a look at wxPython's samples/mainloop/mainloop.py program and it's wxApp's MainLoop function. Hopefully the only problem is that you need to completely flush the events with the "while wx.wxGetApp():Pending()" loop and give the event handler a little kick with wx.wxGetApp():ProcessIdle() every once in a while. see here and the posts before and after it. http://lists.wxwidgets.org/archive/wxPython-users/msg07355.html Regards, John Labenski ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users