Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F65441622
interact.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jun 3, 20:13
Size
823 B
Mime Type
text/x-python
Expires
Wed, Jun 5, 20:13 (2 d)
Engine
blob
Format
Raw Data
Handle
18072648
Attached To
rJNAL Jupyter notebooks for Linear Algebra
interact.py
View Options
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 19 11:22:41 2019
@author: jecker
"""
import
gi
gi
.
require_version
(
'Gtk'
,
'3.0'
)
from
gi.repository
import
Gtk
from
matplotlib.figure
import
Figure
from
matplotlib.backends.backend_gtk3agg
import
FigureCanvas
from
matplotlib.backends.backend_gtk3
import
(
NavigationToolbar2GTK3
as
NavigationToolbar
)
win
=
Gtk
.
Window
()
win
.
connect
(
"destroy"
,
lambda
x
:
Gtk
.
main_quit
())
win
.
set_default_size
(
400
,
300
)
win
.
set_title
(
"Embedding in GTK"
)
vbox
=
Gtk
.
VBox
()
win
.
add
(
vbox
)
fig
=
Figure
(
figsize
=
(
5
,
4
),
dpi
=
100
)
ax
=
fig
.
add_subplot
(
111
)
ax
.
plot
([
1
,
2
,
3
])
canvas
=
FigureCanvas
(
fig
)
# a Gtk.DrawingArea
vbox
.
pack_start
(
canvas
,
True
,
True
,
0
)
toolbar
=
NavigationToolbar
(
canvas
,
win
)
vbox
.
pack_start
(
toolbar
,
False
,
False
,
0
)
win
.
show_all
()
Gtk
.
main
()
Event Timeline
Log In to Comment