- 论坛徽章:
- 0
|
import wx
class Frame(wx.Frame):
def __init__(self, parent, id=-1, title='Button', pos=wx.DefaultPosition,
size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE
):
wx.Frame.__init__(self, parent, id, title, pos, size, style)
self.SetIcon(wx.Icon('wxWidgets.ico', wx.BITMAP_TYPE_ICO))
Panel = wx.Panel(self, -1)
Button = wx.Button(Panel, -1, 'Click Me')
Button.SetToolTipString('This is a button.')
self.Bind(wx.EVT_BUTTON, self.OnTest, Button)
def OnTest(self, event):
wx.MessageBox('You have clicked wx.Button.', 'Prompt')
def TestFrame():
app = wx.PySimpleApp()
frame = Frame(parent=None)
frame.Centre()
frame.Show()
app.MainLoop()
if __name__ == '__main__':
TestFrame()
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/35936/showart_281848.html |
|