FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib/examples/user_interfaces/embedding_in_gtk.py at master · feisuo/matplotlib · GitHub
feisuo
matplotlib
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib
/
examples
/
user_interfaces
/
embedding_in_gtk.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (24 loc) · 814 Bytes
Breadcrumbs
matplotlib
/
examples
/
user_interfaces
/
embedding_in_gtk.py
Copy path
File metadata and controls
32 lines (24 loc) · 814 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
"""
show how to add a matplotlib FigureCanvasGTK or FigureCanvasGTKAgg widget to a
gtk.Window
"""
import
gtk
from
matplotlib
.
figure
import
Figure
from
numpy
import
arange
,
sin
,
pi
# uncomment to select /GTK/GTKAgg/GTKCairo
#from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
from
matplotlib
.
backends
.
backend_gtkagg
import
FigureCanvasGTKAgg
as
FigureCanvas
#from matplotlib.backends.backend_gtkcairo import FigureCanvasGTKCairo as FigureCanvas
win
=
gtk
.
Window
()
win
.
connect
(
"destroy"
,
lambda
x
:
gtk
.
main_quit
())
win
.
set_default_size
(
400
,
300
)
win
.
set_title
(
"Embedding in GTK"
)
f
=
Figure
(
figsize
=
(
5
,
4
),
dpi
=
100
)
a
=
f
.
add_subplot
(
111
)
t
=
arange
(
0.0
,
3.0
,
0.01
)
s
=
sin
(
2
*
pi
*
t
)
a
.
plot
(
t
,
s
)
canvas
=
FigureCanvas
(
f
)
# a gtk.DrawingArea
win
.
add
(
canvas
)
win
.
show_all
()
gtk
.
main
()
Back
|
FazBrowse Home
|
New Git URL