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()

Ralph
http://TheOrangeIT.org
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to