FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
wxPythonDemos/ButtonArray.py at master · PythonCHB/wxPythonDemos · GitHub
PythonCHB
/
wxPythonDemos
Public
Notifications
You must be signed in to change notification settings
Fork
21
Star
28
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
wxPythonDemos
/
ButtonArray.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
55 lines (31 loc) · 1.15 KB
Breadcrumbs
wxPythonDemos
/
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
()
Back
|
FazBrowse Home
|
New Git URL