GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — wxPythonDemos/ButtonArray.py at master · PythonCHB/wxPythonDemos Expand file tree/ Copy pathButtonArray.pyMore file actions executable file ·55 lines (31 loc) · 1.15 KB / Copy pathButtonArray.pyFile metadata and controlsexecutable file ·55 lines (31 loc) · 1.15 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 #!/usr/bin/env python import wx class ButtonArrayPanel(wx.Panel): def __init__(self, *args, **kwargs): wx.Panel.__init__(self, *args, **kwargs) Sizer = wx.GridSizer(16, 2, 0, 0) for i in range(32): B = wx.Button(self, label = "button %i"%i) B.Bind(wx.EVT_BUTTON, lambda evt, but_num = i: self.OnButton(evt, but_num) ) Sizer.Add(B, 0, wx.GROW|wx.ALL, 4) self.SetSizerAndFit(Sizer) def OnButton(self, evt, but_num): print "Button number: %i clicked"%but_num class DemoFrame(wx.Frame): def __init__(self, title = "Button Array Demo"): wx.Frame.__init__(self, None , -1, title) btn = wx.Button(self, label = "Quit") btn.Bind(wx.EVT_BUTTON, self.OnQuit ) BP = ButtonArrayPanel(self) Sizer = wx.BoxSizer(wx.VERTICAL) Sizer.Add(btn, 1, wx.CENTER|wx.ALL, 6) Sizer.Add(BP, 0, wx.CENTER|wx.ALL, 4) self.SetSizerAndFit(Sizer) self.Bind(wx.EVT_CLOSE, self.OnQuit) def OnQuit(self,Event): self.Destroy() app = wx.App(False) frame = DemoFrame() frame.Show() app.MainLoop() |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |