background process

Try a wxTimer. Check out the code below.

from wxPython.wx import *

class MyFrame( wxFrame ):
    def __init__( self ):
        wxFrame.__init__( self, None, -1, "Test" )
        self.SetSize( wxSize( 240, 240 ) )

        # Create a timer. First create the timer's id
        timer_id = wxNewId()

        # Now construct the timer
        self.timer = wxTimer(self, timer_id )

        # Create an event handler for the timer
        EVT_TIMER(self, timer_id, self.on_time )

        # Start the timer
        self.timer.Start( 2000 )

    def on_time( self, e ):
        print " 2 seconds have elapsed since the timer started "

class MyApp( wxApp ):
    def OnInit( self ):
        frame = MyFrame()
        frame.Show( true )
        return true

def main():
    app = MyApp(0)
    app.MainLoop()

if __name__ == "__main__":
    main()

HTH,
jw

···

-----Original Message-----
From: travis [mailto:travis.smith@tycoelectronics.com]
Sent: Wednesday, July 09, 2003 2:06 PM
To: wxpython
Subject: [wxPython-users] background process

Hi,

I'm working on a queuing program and have been able to make
the gui and
have it work as I'd expected, but I'm running into trouble with having
the script keep doing something in between gui events. What I have is
two queues in listboxes with which I can manipulate items up
and down as
well as move them from queue to queue. What I'd like to do is every
couple of seconds, regardless of user input, delete the top item from
each queue until everything is done.

The structure of my program is pretty simple, mostly I just
need to know
where to put the instructions where they'll get executed repeatedly,
regardless of other things. I've attached the script so
it'll be easier
to see what I'm doing.

Thanks in advance,
--

Travis Smith
Unix Systems Manager
Tyco Electronics PCG
Logan, Utah
435-753-4700 x3030

Thanks, that's exactly what I was looking for. It'll help out a ton.
Then I suppose I would just set up a separate timer event for each
separate thing that needed to happen at different time intervals?

···

On Wed, 2003-07-09 at 13:36, Wyant, Jaime wrote:

Try a wxTimer. Check out the code below.

from wxPython.wx import *

class MyFrame( wxFrame ):
    def __init__( self ):
        wxFrame.__init__( self, None, -1, "Test" )
        self.SetSize( wxSize( 240, 240 ) )

        # Create a timer. First create the timer's id
        timer_id = wxNewId()

        # Now construct the timer
        self.timer = wxTimer(self, timer_id )

        # Create an event handler for the timer
        EVT_TIMER(self, timer_id, self.on_time )

        # Start the timer
        self.timer.Start( 2000 )

    def on_time( self, e ):
        print " 2 seconds have elapsed since the timer started "

class MyApp( wxApp ):
    def OnInit( self ):
        frame = MyFrame()
        frame.Show( true )
        return true

def main():
    app = MyApp(0)
    app.MainLoop()

if __name__ == "__main__":
    main()

HTH,
jw

>>-----Original Message-----
>>From: travis [mailto:travis.smith@tycoelectronics.com]
>>Sent: Wednesday, July 09, 2003 2:06 PM
>>To: wxpython
>>Subject: [wxPython-users] background process
>>
>>
>>Hi,
>>
>>I'm working on a queuing program and have been able to make
>>the gui and
>>have it work as I'd expected, but I'm running into trouble with having
>>the script keep doing something in between gui events. What I have is
>>two queues in listboxes with which I can manipulate items up
>>and down as
>>well as move them from queue to queue. What I'd like to do is every
>>couple of seconds, regardless of user input, delete the top item from
>>each queue until everything is done.
>>
>>The structure of my program is pretty simple, mostly I just
>>need to know
>>where to put the instructions where they'll get executed repeatedly,
>>regardless of other things. I've attached the script so
>>it'll be easier
>>to see what I'm doing.
>>
>>
>>
>>Thanks in advance,
>>--
>>
>>Travis Smith
>>Unix Systems Manager
>>Tyco Electronics PCG
>>Logan, Utah
>>435-753-4700 x3030
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

--

Travis Smith
Unix Systems Manager
Tyco Electronics PCG
Logan, Utah
435-753-4700 x3030