On Jun 8, 8:51 pm, ralphz <[EMAIL PROTECTED]> wrote: > Hi > > I have small app that I want to close tself after x seconds. Basically > start show some message and close. > > I come up with something like this but it does not work. Can anyone help > me with it? > > #!/usr/bin/env python > > import wx > import time > > class MyFrame(wx.Frame): > def __init__(self, title, pos, size): > wx.Frame.__init__(self, None, -1, title, pos, size) > self.CreateStatusBar() > self.SetStatusText("Some message here") > > class MyApp(wx.App): > def OnInit(self): > > self.frame = MyFrame('TITLE', (100, 100), (400,100)) > self.frame.Show() > > self.SetTopWindow(self.frame) > self.ID_Timer = wx.NewEventType() > self.timer = wx.Timer(self, self.ID_Timer) > self.timer.Start(5000, False) > self.Bind(wx.EVT_TIMER, self.appclose, self.timer) > # wx.EVT_TIMER(self, self.ID_Timer, self.appclose) > return True > > def appclose(self, evt): > self.frame.Destroy() > > if __name__ == '__main__': > app = MyApp(0) > app.MainLoop() > > Ralphhttp://TheOrangeIT.org
It works for me just fine. How is it not working for you? By the way, showing your message in the statusbar is not a good display method--it's small and it is only seen in conjunction with a frame above it that is doing something. You could just put the message as staticText. -- http://mail.python.org/mailman/listinfo/python-list