#!/bin/env python # coding: utf-8 import wxversion wxversion.select('2.6') import wx class MainFrame(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, (-1, -1), (150, 34)) panel = wx.Panel(self, -1) button = wx.Button(panel, 10, 'Button') wx.EVT_BUTTON(self, 10, self.OnClick) box = wx.BoxSizer(wx.HORIZONTAL) box.Add(button, 1) panel.SetSizer(box) def OnClick(self, event): self.Close() class App(wx.App): def OnInit(self): frame = MainFrame(None, -1, 'test.py') frame.Show(True) frame.Centre() return True app = App(0) app.MainLoop()