Frame with events : Frame : WxPython PYTHON TUTORIALS


PYTHON TUTORIALS » WxPython » Frame »

 

Frame with events


Frame with events: on close, on close window
import wx

class InsertFrame(wx.Frame):
    def __init__(self, parent, id):
        wx.Frame.__init__(self, parent, id, 'Frame With Button',size=(300100))
        panel = wx.Panel(self)
        button = wx.Button(panel, label="Close", pos=(12510),size=(5050))
        self.Bind(wx.EVT_BUTTON, self.OnCloseMe, button)
        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)

    def OnCloseMe(self, event):
        self.Close(True)

    def OnCloseWindow(self, event):
        self.Destroy()

app = wx.PySimpleApp()
frame = InsertFrame(parent=None, id=-1)
frame.Show()
app.MainLoop()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo WxPython
» Frame