seanjensengrey / cogen

Automatically exported from code.google.com/p/cogen
MIT License
0 stars 0 forks source link

How do I...wxReactor #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Is there a way to make cogen work with wxWidgets? Kinda "wxreactor"?

Original issue reported on code.google.com by roger.py...@gmail.com on 14 Jul 2008 at 7:31

GoogleCodeExporter commented 8 years ago
You could get the sched as an iterable and iter it on an idle event (note the 
bind)

Though performance is abysmal.

{{{
sched = Scheduler()
sched_iter = sched.iter_run()

from wx import *

class MyApp(App):
    def OnInit(self):
        frame = Frame(None, -1, "Hello world")
        frame.Show(True)

        self.Bind(wx.EVT_IDLE, self.OnIdle)

        return True

    def OnIdle(self, evt):
        sched_iter.next()

app = MyApp(0)
app.MainLoop()}}}

Original comment by ionel...@gmail.com on 16 Jul 2008 at 6:06

GoogleCodeExporter commented 8 years ago
The other option is to run the cogen scheduler in another thread

Original comment by ionel...@gmail.com on 16 Jul 2008 at 6:09

GoogleCodeExporter commented 8 years ago
Maybe I could create a Timer, just like the QtReactor does.

Thank you so much!

Original comment by roger.py...@gmail.com on 16 Jul 2008 at 11:47

GoogleCodeExporter commented 8 years ago

Original comment by ionel...@gmail.com on 24 Nov 2008 at 9:02