#!/usr/bin/env python#-*- coding: utf-8 -*-
importwxclassMyFrame(wx.Frame):def __init__(self, parent, id):
wx.Frame.__init__(self, parent, id, u'测试面板Panel', size = (600, 300))#创建面板
panel =wx.Panel(self)#在Panel上添加Button
button = wx.Button(panel, label = u'关闭', pos = (150, 60), size = (100, 60))#绑定单击事件
self.Bind(wx.EVT_BUTTON, self.OnCloseMe, button)defOnCloseMe(self, event):
self.Close(True)if __name__ == '__main__':
app=wx.PySimpleApp()
frame= MyFrame(parent = None, id = -1)
frame.Show()
app.MainLoop()