GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — wxPythonDemos/ButtonArray.py at master · PythonCHB/wxPythonDemos

Expand file tree

/

ButtonArray.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
55 lines (31 loc) · 1.15 KB
/

ButtonArray.py

Copy path

File metadata and controls

executable file
·
55 lines (31 loc) · 1.15 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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.