FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
wxPythonDemos/BitmapFromPILTest.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
/
BitmapFromPILTest.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
35 lines (26 loc) · 888 Bytes
Breadcrumbs
wxPythonDemos
/
BitmapFromPILTest.py
Copy path
File metadata and controls
executable file
·
35 lines (26 loc) · 888 Bytes
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
#!/usr/bin/env python
"""
A test of making wx.Bitmap from a PIL image
"""
import
wx
import
PIL
.
Image
class
DemoFrame
(
wx
.
Frame
):
""" This window displays a button """
def
__init__
(
self
,
title
=
"Bitmap Demo"
):
wx
.
Frame
.
__init__
(
self
,
None
,
-
1
,
title
)
#, size = (800,600), style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE)
# load the PIL image:
image
=
PIL
.
Image
.
open
(
'splash.png'
)
image
=
image
.
convert
(
'RGB'
)
image
=
image
.
resize
((
100
,
100
),
PIL
.
Image
.
ANTIALIAS
)
w
,
h
=
image
.
size
self
.
bitmap
=
wx
.
BitmapFromBuffer
(
w
,
h
,
image
.
tostring
() )
self
.
Bind
(
wx
.
EVT_PAINT
,
self
.
OnPaint
)
def
OnPaint
(
self
,
evt
):
dc
=
wx
.
PaintDC
(
self
)
dc
.
DrawBitmap
(
self
.
bitmap
,
10
,
10
)
def
OnQuit
(
self
,
Event
):
self
.
Destroy
()
app
=
wx
.
App
(
False
)
frame
=
DemoFrame
()
frame
.
Show
()
app
.
MainLoop
()
Back
|
FazBrowse Home
|
New Git URL