This file contains the SVN revision history for buttonpanel, at revision 68933.
Available information include commit date, the name of the committer, the file size, the SVN log messages and a diff from the previous version (if available).
The following log message was entered by the committer:
AGW: Some further refactoring of the docs: - Added downloadable snippets of code in the Sphinx documentation itself; - Re-run 2to3 afresh so that the patches are up-to-date for Python 3.
Version SVN diff:
--- wxPython/3rdParty/AGW/agw/buttonpanel.py 2011/08/25 16:40:17 68881
+++ wxPython/3rdParty/AGW/agw/buttonpanel.py 2011/08/27 17:11:41 68933
@@ -86,66 +86,67 @@
Usage example::
- import wx
- import wx.lib.agw.buttonpanel as BP
-
- class MyFrame(wx.Frame):
+ import wx
+ import wx.lib.agw.buttonpanel as BP
- def __init__(self, parent, id=-1, title="ButtonPanel", pos=wx.DefaultPosition,
- size=(800, 600), style=wx.DEFAULT_FRAME_STYLE):
+ class MyFrame(wx.Frame):
+
+ def __init__(self, parent, id=-1, title="ButtonPanel", pos=wx.DefaultPosition,
+ size=(800, 600), style=wx.DEFAULT_FRAME_STYLE):
- wx.Frame.__init__(self, parent, id, title, pos, size, style)
+ wx.Frame.__init__(self, parent, id, title, pos, size, style)
+
+ mainPanel = wx.Panel(self, -1)
+ self.logtext = wx.TextCtrl(mainPanel, -1, "", style=wx.TE_MULTILINE)
+
+ vSizer = wx.BoxSizer(wx.VERTICAL)
+ mainPanel.SetSizer(vSizer)
+
+ titleBar = BP.ButtonPanel(mainPanel, -1, "A Simple Test & Demo")
+
+ btn1 = BP.ButtonInfo(titleBar, wx.NewId(), wx.Bitmap("png4.png", wx.BITMAP_TYPE_PNG))
+ titleBar.AddButton(btn1)
+ self.Bind(wx.EVT_BUTTON, self.OnButton, btn1)
- mainPanel = wx.Panel(self, -1)
- self.logtext = wx.TextCtrl(mainPanel, -1, "", style=wx.TE_MULTILINE)
+ btn2 = BP.ButtonInfo(titleBar, wx.NewId(), wx.Bitmap("png3.png", wx.BITMAP_TYPE_PNG))
+ titleBar.AddButton(btn2)
+ self.Bind(wx.EVT_BUTTON, self.OnButton, btn2)
- vSizer = wx.BoxSizer(wx.VERTICAL)
- mainPanel.SetSizer(vSizer)
+ btn3 = BP.ButtonInfo(titleBar, wx.NewId(), wx.Bitmap("png2.png", wx.BITMAP_TYPE_PNG))
+ titleBar.AddButton(btn3)
+ self.Bind(wx.EVT_BUTTON, self.OnButton, btn3)
- titleBar = BP.ButtonPanel(mainPanel, -1, "A Simple Test & Demo")
+ btn4 = BP.ButtonInfo(titleBar, wx.NewId(), wx.Bitmap("png1.png", wx.BITMAP_TYPE_PNG))
+ titleBar.AddButton(btn4)
+ self.Bind(wx.EVT_BUTTON, self.OnButton, btn4)
- btn1 = BP.ButtonInfo(titleBar, wx.NewId(), wx.Bitmap("png4.png", wx.BITMAP_TYPE_PNG))
- titleBar.AddButton(btn1)
- self.Bind(wx.EVT_BUTTON, self.OnButton, btn1)
+ vSizer.Add(titleBar, 0, wx.EXPAND)
+ vSizer.Add((20, 20))
+ vSizer.Add(self.logtext, 1, wx.EXPAND|wx.ALL, 5)
- btn2 = BP.ButtonInfo(titleBar, wx.NewId(), wx.Bitmap("png3.png", wx.BITMAP_TYPE_PNG))
- titleBar.AddButton(btn2)
- self.Bind(wx.EVT_BUTTON, self.OnButton, btn2)
+ titleBar.DoLayout()
+ vSizer.Layout()
- btn3 = BP.ButtonInfo(titleBar, wx.NewId(), wx.Bitmap("png2.png", wx.BITMAP_TYPE_PNG))
- titleBar.AddButton(btn3)
- self.Bind(wx.EVT_BUTTON, self.OnButton, btn3)
- btn4 = BP.ButtonInfo(titleBar, wx.NewId(), wx.Bitmap("png1.png", wx.BITMAP_TYPE_PNG))
- titleBar.AddButton(btn4)
- self.Bind(wx.EVT_BUTTON, self.OnButton, btn4)
+ def OnButton(self, event):
+ ''' Handler for the ``wx.EVT_BUTTON`` event. '''
- vSizer.Add(titleBar, 0, wx.EXPAND)
- vSizer.Add((20, 20))
- vSizer.Add(self.logtext, 1, wx.EXPAND|wx.ALL, 5)
+ obj = event.GetEventObject()
- titleBar.DoLayout()
- vSizer.Layout()
+ # This will print the button label
+ print obj.GetText()
- def OnButton(self, event):
- ''' Handler for the ``wx.EVT_BUTTON`` event. '''
+ # our normal wxApp-derived class, as usual
- obj = event.GetEventObject()
+ app = wx.PySimpleApp()
- # This will print the button label
- print obj.GetText()
+ frame = MyFrame(None)
+ app.SetTopWindow(frame)
+ frame.Show()
-
- # our normal wxApp-derived class, as usual
+ app.MainLoop()
- app = wx.PySimpleApp()
-
- frame = MyFrame(None)
- app.SetTopWindow(frame)
- frame.Show()
-
- app.MainLoop()
Window Styles