FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib/examples/user_interfaces/embedding_in_wx5.py at master · gitj/matplotlib · GitHub
gitj
matplotlib
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib
/
examples
/
user_interfaces
/
embedding_in_wx5.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
52 lines (43 loc) · 1.55 KB
Breadcrumbs
matplotlib
/
examples
/
user_interfaces
/
embedding_in_wx5.py
Copy path
File metadata and controls
52 lines (43 loc) · 1.55 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
# Used to guarantee to use at least Wx2.8
import
wxversion
wxversion
.
ensureMinimal
(
'2.8'
)
import
wx
import
wx
.
aui
import
matplotlib
as
mpl
from
matplotlib
.
backends
.
backend_wxagg
import
FigureCanvasWxAgg
as
Canvas
from
matplotlib
.
backends
.
backend_wxagg
import
NavigationToolbar2Wx
as
Toolbar
class
Plot
(
wx
.
Panel
):
def
__init__
(
self
,
parent
,
id
=
-
1
,
dpi
=
None
,
**
kwargs
):
wx
.
Panel
.
__init__
(
self
,
parent
,
id
=
id
,
**
kwargs
)
self
.
figure
=
mpl
.
figure
.
Figure
(
dpi
=
dpi
,
figsize
=
(
2
,
2
))
self
.
canvas
=
Canvas
(
self
,
-
1
,
self
.
figure
)
self
.
toolbar
=
Toolbar
(
self
.
canvas
)
self
.
toolbar
.
Realize
()
sizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
sizer
.
Add
(
self
.
canvas
,
1
,
wx
.
EXPAND
)
sizer
.
Add
(
self
.
toolbar
,
0
,
wx
.
LEFT
|
wx
.
EXPAND
)
self
.
SetSizer
(
sizer
)
class
PlotNotebook
(
wx
.
Panel
):
def
__init__
(
self
,
parent
,
id
=
-
1
):
wx
.
Panel
.
__init__
(
self
,
parent
,
id
=
id
)
self
.
nb
=
wx
.
aui
.
AuiNotebook
(
self
)
sizer
=
wx
.
BoxSizer
()
sizer
.
Add
(
self
.
nb
,
1
,
wx
.
EXPAND
)
self
.
SetSizer
(
sizer
)
def
add
(
self
,
name
=
"plot"
):
page
=
Plot
(
self
.
nb
)
self
.
nb
.
AddPage
(
page
,
name
)
return
page
.
figure
def
demo
():
app
=
wx
.
PySimpleApp
()
frame
=
wx
.
Frame
(
None
,
-
1
,
'Plotter'
)
plotter
=
PlotNotebook
(
frame
)
axes1
=
plotter
.
add
(
'figure 1'
).
gca
()
axes1
.
plot
([
1
,
2
,
3
],[
2
,
1
,
4
])
axes2
=
plotter
.
add
(
'figure 2'
).
gca
()
axes2
.
plot
([
1
,
2
,
3
,
4
,
5
],[
2
,
1
,
4
,
2
,
3
])
#axes1.figure.canvas.draw()
#axes2.figure.canvas.draw()
frame
.
Show
()
app
.
MainLoop
()
if
__name__
==
"__main__"
:
demo
()
Back
|
FazBrowse Home
|
New Git URL