Is it possible/easy to set up the event loop so that it runs some sort
of check_for_new_files() method say every 30 seconds? Thx Brennan _______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev |
On Sun, Feb 6, 2011 at 9:41 PM, Brennan Williams
<[hidden email]> wrote: > Is it possible/easy to set up the event loop so that it runs some sort > of check_for_new_files() method say every 30 seconds? There is no Traits event loop. If you have a GUI app, use the GUI event loop. We do wrap the toolkits' timer objects in Pyface, if you want to be backend-independent. from enthought.pyface.timer.api import Timer t = Timer(30*1000, check_for_new_files) t.Start() -- Robert Kern Enthought _______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev |
On 7/02/2011 4:55 p.m., Robert Kern wrote:
> On Sun, Feb 6, 2011 at 9:41 PM, Brennan Williams > <[hidden email]> wrote: >> Is it possible/easy to set up the event loop so that it runs some sort >> of check_for_new_files() method say every 30 seconds? > There is no Traits event loop. If you have a GUI app, use the GUI > event loop. We do wrap the toolkits' timer objects in Pyface, if you > want to be backend-independent. > > OK yes I'm using GUI as in... gui=GUI() ..... gui.start_event_loop() > from enthought.pyface.timer.api import Timer > > t = Timer(30*1000, check_for_new_files) > t.Start() > So if I use Timer does it go off in a separate thread? I'm thinking of having a method that checks for new files and updates a Traits List which is in the View being displayed. Sound ok? I'm having a bit of a dig around the pyface code this evening to understand what's going on. Thx Brennan _______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev |
On 7/02/2011 9:29 p.m., Brennan Williams wrote:
> On 7/02/2011 4:55 p.m., Robert Kern wrote: >> On Sun, Feb 6, 2011 at 9:41 PM, Brennan Williams >> <[hidden email]> wrote: >>> Is it possible/easy to set up the event loop so that it runs some sort >>> of check_for_new_files() method say every 30 seconds? >> There is no Traits event loop. If you have a GUI app, use the GUI >> event loop. We do wrap the toolkits' timer objects in Pyface, if you >> want to be backend-independent. >> >> > OK yes I'm using GUI as in... > > gui=GUI() > ..... > gui.start_event_loop() > >> from enthought.pyface.timer.api import Timer >> >> t = Timer(30*1000, check_for_new_files) >> t.Start() >> > So if I use Timer does it go off in a separate thread? I'm thinking of > having a method that checks for new files and updates a Traits List > which is in the View being displayed. Sound ok? I'm having a bit of a > dig around the pyface code this evening to understand what's going on. > https://svn.enthought.com/enthought/browser/TraitsGUI/trunk/examples/timer.py?rev=23585 Brennan > Thx > > Brennan > > > _______________________________________________ > Enthought-Dev mailing list > [hidden email] > https://mail.enthought.com/mailman/listinfo/enthought-dev > _______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev |
On Mon, Feb 7, 2011 at 4:05 AM, Brennan Williams <[hidden email]> wrote:
The time is a toolkit-specific timer. If you are using wx, the pyface timer uses a wx.Timer. If you are using qt, the pyface timer will use a QTimer. The timer is managed by the gui toolkit. It runs in the main gui event loop thread.
_______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev |
Free forum by Nabble | Edit this page |