article

Saturday, May 28, 2016

wxpython dialogs wx.MessageBox

wxpython dialogs wx.MessageBox
 
import wx

class Example(wx.Frame):
    
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs) 
            
        self.InitUI()
        
    def InitUI(self):    

        wx.FutureCall(5000, self.ShowMessage) #wx.FutureCall shows a message box after 5 seconds. 5000 milliseconds, self.ShowMessage method 

        self.SetSize((300, 200))
        self.SetTitle('Message box')
        self.Centre()
        self.Show(True)

    def ShowMessage(self):
        wx.MessageBox('Download completed', 'Info', 
            wx.OK | wx.ICON_INFORMATION)


def main():
    
    ex = wx.App()
    Example(None)
    ex.MainLoop()    


if __name__ == '__main__':
    main()   

Related Post