13.07.2015 Views

The wxPython tutorial

The wxPython tutorial

The wxPython tutorial

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Events in <strong>wxPython</strong>http://www.zetcode.com/wxpython/events/Standard identifiers should be used whenever possible. <strong>The</strong>identifiers can provide some standard graphics or behaviour onsome platforms.#!/usr/bin/python# identifiers.pyimport wxclass Identifiers(wx.Frame):def __init__(self, parent, id, title):wx.Frame.__init__(self, parent, id, title, size=(200, 150))panel = wx.Panel(self, -1)grid = wx.GridSizer(3, 2)grid.AddMany([(wx.Button(panel, wx.ID_CANCEL), 0, wx.TOP | wx.LEFT, 9),(wx.Button(panel, wx.ID_DELETE), 0, wx.TOP, 9),(wx.Button(panel, wx.ID_SAVE), 0, wx.LEFT, 9),(wx.Button(panel, wx.ID_EXIT)),(wx.Button(panel, wx.ID_STOP), 0, wx.LEFT, 9),(wx.Button(panel, wx.ID_NEW))])self.Bind(wx.EVT_BUTTON, self.OnQuit, id=wx.ID_EXIT)panel.SetSizer(grid)self.Centre()self.Show(True)def OnQuit(self, event):self.Close()app = wx.App()Identifiers(None, -1, '')app.MainLoop()In our example we use standard identifiers on buttons. On linux,the buttons have small icons.8 de 14 27/04/2008 1:03

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!