Frames and Dialogs → MiniFrame


import wx
class Frame(wx.MiniFrame):
def __init__(
  self, parent, id, title, pos=wx.DefaultPosition, size=wx.DefaultSize,
  style=wx.DEFAULT_FRAME_STYLE
  ):
  
  wx.MiniFrame.__init__(self, parent, id, title, pos, size, style)
  
  panel = wx.Panel(self, -1)
  
  button = wx.Button(panel, -1, "Close Me")
  button.SetPosition((15, 15))
  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):
  print "OnCloseWindow"
  self.Destroy()
  
def TestFrame():
app = wx.PySimpleApp()
frame = Frame(parent=None, id=-1, title="wx.MiniFrame")
fraem.Centre()
frame.Show()
app.MainLoop()

if __name__ =="__main__":
TestFrame()