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/def OnKillFocus(self, event):self.color = '#b3b3b3'self.Refresh()class FocusEvent(wx.Frame):def __init__(self, parent, id, title):wx.Frame.__init__(self, parent, id, title, size=(350, 250))grid = wx.GridSizer(2, 2, 10, 10)grid.AddMany([(MyWindow(self), 1, wx.EXPAND|wx.TOP|wx.LEFT,9),(MyWindow(self), 1, wx.EXPAND|wx.TOP|wx.RIGHT, 9),(MyWindow(self), 1, wx.EXPAND|wx.BOTTOM|wx.LEFT, 9),(MyWindow(self), 1, wx.EXPAND|wx.BOTTOM|wx.RIGHT, 9)])self.SetSizer(grid)self.Centre()self.Show(True)app = wx.App()FocusEvent(None, -1, 'focus event')app.MainLoop()In our example, we have four panels. <strong>The</strong> panel with focus ishighlighted.Figure: focus eventScrollEvent<strong>The</strong> following code is an example of a wx.ScrollWinEvent. Thisevent is generated, when we click on a built in Scrollbar. Built-inScrollbar is activated with the SetScrollbar() method call. Forstand-alone Scrollbars, there is another event type, namely10 de 14 27/04/2008 1:03

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

Saved successfully!

Ooh no, something went wrong!