hi,
i have a problem integrating wxPython and Twisted under Win32. my
application consumes 40-50% of CPU resources when wxFrame is visible and reactor
(twisted) is running. i looked at integration example which comes with twisted
package and figured that it also has that problem. here comes listing:
PYTHON_HOME\Lib \site-packages\Twiste dDocs\examples\ wxdemo.py
#----------------------------------------------------------------
from wxPython.wx import *
from twisted.interne t import wxreactor
wxreactor.insta ll()
from twisted.interne t import reactor
# set up so that "hello, world" is printed once a second
def helloWorld():
print "hello, world"
reactor.callLat er(1, helloWorld)
reactor.callLat er(1, helloWorld)
def twoSecondsPasse d():
print "two seconds passed"
reactor.callLat er(2, twoSecondsPasse d)
ID_EXIT = 101
class MyFrame(wxFrame ):
def __init__(self, parent, ID, title):
wxFrame.__init_ _(self, parent, ID, title, wxDefaultPositi on, wxSize(300, 200))
menu = wxMenu()
menu.Append(ID_ EXIT, "E&xit", "Terminate the program")
menuBar = wxMenuBar()
menuBar.Append( menu, "&File");
self.SetMenuBar (menuBar)
EVT_MENU(self, ID_EXIT, self.DoExit)
def DoExit(self, event):
self.Close(true )
reactor.stop()
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(NULL, -1, "Hello, world")
frame.Show(true )
self.SetTopWind ow(frame)
return true
def demo():
app = MyApp(0)
reactor.registe rWxApp(app)
reactor.run(0)
if __name__ == '__main__':
demo()
#----------------------------------------------------------------
can You help me? has anyone encountered similar problem?
--
marchew mailto:darek@ti ger.com.pl
--
_______________ _______________ _______________ __
Python-win32 mailing list
Python-win32@python.or g
i have a problem integrating wxPython and Twisted under Win32. my
application consumes 40-50% of CPU resources when wxFrame is visible and reactor
(twisted) is running. i looked at integration example which comes with twisted
package and figured that it also has that problem. here comes listing:
PYTHON_HOME\Lib \site-packages\Twiste dDocs\examples\ wxdemo.py
#----------------------------------------------------------------
from wxPython.wx import *
from twisted.interne t import wxreactor
wxreactor.insta ll()
from twisted.interne t import reactor
# set up so that "hello, world" is printed once a second
def helloWorld():
print "hello, world"
reactor.callLat er(1, helloWorld)
reactor.callLat er(1, helloWorld)
def twoSecondsPasse d():
print "two seconds passed"
reactor.callLat er(2, twoSecondsPasse d)
ID_EXIT = 101
class MyFrame(wxFrame ):
def __init__(self, parent, ID, title):
wxFrame.__init_ _(self, parent, ID, title, wxDefaultPositi on, wxSize(300, 200))
menu = wxMenu()
menu.Append(ID_ EXIT, "E&xit", "Terminate the program")
menuBar = wxMenuBar()
menuBar.Append( menu, "&File");
self.SetMenuBar (menuBar)
EVT_MENU(self, ID_EXIT, self.DoExit)
def DoExit(self, event):
self.Close(true )
reactor.stop()
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(NULL, -1, "Hello, world")
frame.Show(true )
self.SetTopWind ow(frame)
return true
def demo():
app = MyApp(0)
reactor.registe rWxApp(app)
reactor.run(0)
if __name__ == '__main__':
demo()
#----------------------------------------------------------------
can You help me? has anyone encountered similar problem?
--
marchew mailto:darek@ti ger.com.pl
--
_______________ _______________ _______________ __
Python-win32 mailing list
Python-win32@python.or g
Comment