![]() |
|
|
|||||||
![]() |
Python - My first wxPython App with Twisted - barebones version |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Hi,
I am creating the first GUI app (wxPython based) using Twisted. I am facing an issue which I cannot seem to solve/understand due to lack of trace or anything. I had a big app written on twisted and now I am creating a login screen to the app. The app used to work without any issues. I added the login screen and the login screen comes up. But then everything freezes up. I have to force quit the python application to get anything back. Can anyone help me solve it? The code is as follows: import wx import os import logging from twisted.internet import wxreactor wxreactor.install() from twisted.internet import reactor #Called only after wxreactor.install() from twisted.internet.task import LoopingCall import clientapp def opj(path): """ Convert paths to the platform-specific separator """ st = apply(os.path.join, tuple(path.split('/'))) if path.startswith('/'): st = '/' + st return st class APPApp(wx.App): def OnInit(self): self.frame = APPFrame(None, -1, " APP Login", size=(200, 150)) self.panel = APPPanel(self.frame,-1) client = clientapp.setup_app() call = LoopingCall(client.run) call.start(.51) return True def main(): app = APPApp(0) reactor.registerWxApp(app) try: reactor.run() except StandardError: raise class APPFrame(wx.Frame): def __init__(self, parent, id, title, size=None): wx.Frame.__init__(self, parent, id, title, size=size, pos=wx.Point(400, 300)) icon = self.get_icon() self.SetIcon(icon) self.Show(True) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.Bind(wx.EVT_ICONIZE, self.OnIconify) def on_login_click(self, username, password): self.Hide() def OnCloseWindow(self, event): event.Skip() def OnIconify(self, event): self.Hide() def get_image(self): img= wx.Image(opj('client.ico'), wx.BITMAP_TYPE_ICO) return img def get_icon(self): img = self.get_image() icon = wx.IconFromBitmap(img.ConvertToBitmap() ) return icon if __name__ == '__main__': main() koranthala |
|
|
|
|
#2 |
|
Posts: n/a
|
On Aug 5, 6:41*am, koranthala <koranth...@gmail.com> wrote:
> Hi, > * *I am creating the first GUI app (wxPython based) using Twisted. > * *I am facing an issue which I cannot seem to solve/understand due > to lack of trace or anything. > * *I had a big app written on twisted and now I am creating a login > screen to the app. > * *The app used to work without any issues. I added the login screen > and the login screen comes up. > * * But then everything freezes up. I have to force quit the python > application to get anything back. Can anyone help me solve it? > * *The code is as follows: > > import wx > import os > import logging > > from twisted.internet import wxreactor > wxreactor.install() > from twisted.internet import reactor #Called only after > wxreactor.install() > from twisted.internet.task import LoopingCall > > import clientapp > > def opj(path): > * * """ Convert paths to the platform-specific separator """ > * * st = apply(os.path.join, tuple(path.split('/'))) > * * if path.startswith('/'): > * * * * st = '/' + st > * * return st > > class APPApp(wx.App): > * * def OnInit(self): > * * * * self.frame = APPFrame(None, -1, " APP Login", size=(200, 150)) > * * * * self.panel = APPPanel(self.frame,-1) > * * * * client = clientapp.setup_app() > * * * * call = LoopingCall(client.run) > * * * * call.start(.51) > * * * * return True > > def main(): > * * app = APPApp(0) > * * reactor.registerWxApp(app) > * * try: > * * * * reactor.run() > * * except StandardError: > * * * * raise > > class APPFrame(wx.Frame): > * * def __init__(self, parent, id, title, size=None): > * * * * wx.Frame.__init__(self, parent, id, title, > * * * * * * * * * * * * * size=size, pos=wx..Point(400, 300)) > * * * * icon = self.get_icon() > * * * * self.SetIcon(icon) > * * * * self.Show(True) > * * * * self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) > * * * * self.Bind(wx.EVT_ICONIZE, self.OnIconify) > > * * def on_login_click(self, username, password): > * * * * self.Hide() > > * * def OnCloseWindow(self, event): > * * * * event.Skip() > > * * def OnIconify(self, event): > * * * * self.Hide() > > * * def get_image(self): > * * * * img= wx.Image(opj('client.ico'), wx.BITMAP_TYPE_ICO) > * * * * return img > > * * def get_icon(self): > * * * * img = self.get_image() > * * * * icon = wx.IconFromBitmap(img.ConvertToBitmap() ) > * * * * return icon > > if __name__ == '__main__': > * * main() Sorry for spamming this group. I found that this was due to a interaction with pyHook and the wxPython GUI. I havent solved it, but atleast it is not due to twisted and wxPython. koranthala |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Specials on Nov with irresistible gift! Find yours and take advantageof Christmas around the corner | yafei617@sina.com | DVD Video | 0 | 11-28-2007 04:09 PM |
| Specials on Nov with irresistible gift! Find yours and take advantageof Christmas around the corner | aa | DVD Video | 0 | 11-27-2007 02:18 PM |
| ALL NEW TV SHOW MOVIE DVD BOXSETS ONSALE | candemo2006@gmail.com | DVD Video | 1 | 08-31-2007 04:05 AM |
| ALL NEW TV SHOW MOVIE DVD BOXSETS ONSALE | candemo2006@gmail.com | DVD Video | 1 | 08-22-2007 07:05 PM |
| DUNE Extended edition - is it the same cut that aired on Sci Fi? | Joseph S. Powell, III | DVD Video | 13 | 01-30-2006 02:47 PM |