FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
wxPythonDemos/GenStaticBitmap.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
/
GenStaticBitmap.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
62 lines (42 loc) · 1.63 KB
Breadcrumbs
wxPythonDemos
/
GenStaticBitmap.py
Copy path
File metadata and controls
executable file
·
62 lines (42 loc) · 1.63 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
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python
import
wx
import
wx
.
lib
.
statbmp
class
cWindowBitmap
(
wx
.
lib
.
statbmp
.
GenStaticBitmap
):
"""
A subclass of GenStaticBitmap, that adds some functionality
"""
def
__init__
(
self
,
parent
,
bitmapfilename
,
ImageNumber
,
**
kwargs
):
self
.
bitmap
=
wx
.
Bitmap
(
bitmapfilename
)
wx
.
lib
.
statbmp
.
GenStaticBitmap
.
__init__
(
self
,
parent
,
wx
.
ID_ANY
,
self
.
bitmap
,
**
kwargs
)
self
.
parent
=
parent
self
.
filename
=
bitmapfilename
self
.
ImageNumber
=
ImageNumber
self
.
Bind
(
wx
.
EVT_LEFT_DOWN
,
self
.
OnLeftDown
)
self
.
Bind
(
wx
.
EVT_LEFT_UP
,
self
.
OnLeftUp
)
def
OnLeftDown
(
self
,
event
):
print
(
"In Left Down of:"
,
self
.
filename
)
self
.
parent
.
OnBitmapClicked
(
self
.
ImageNumber
)
def
OnLeftUp
(
self
,
event
):
print
(
"In Left Up of:"
,
self
.
filename
)
class
MainFrame
(
wx
.
Frame
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
wx
.
Frame
.
__init__
(
self
,
*
args
,
**
kwargs
)
Sizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
# These represent "many" bitmaps.
[
Sizer
.
Add
(
cWindowBitmap
(
self
,
"Images/smalltest.jpg"
,
i
),
0
,
wx
.
ALL
,
10
)
for
i
in
range
(
3
)]
self
.
SetSizerAndFit
(
Sizer
)
self
.
Bind
(
wx
.
EVT_CLOSE
,
self
.
OnCloseWindow
)
def
OnBitmapClicked
(
self
,
ImageNumber
):
print
(
"Image: %i was clicked"
%
ImageNumber
)
def
OnCloseWindow
(
self
,
event
):
self
.
Destroy
()
class
App
(
wx
.
App
):
def
OnInit
(
self
):
frame
=
MainFrame
(
None
,
-
1
,
"wxWindowBitmap Test"
,
wx
.
DefaultPosition
, (
550
,
600
))
self
.
SetTopWindow
(
frame
)
frame
.
Show
(
True
)
return
True
if
__name__
==
'__main__'
:
app
=
App
(
0
)
app
.
MainLoop
()
Back
|
FazBrowse Home
|
New Git URL