Menu

[r5978]: / trunk / htdocs / screenshots / eeg.py  Maximize  Restore  History

Download this file

38 lines (29 with data), 722 Bytes

 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
# This is a simple example to show you how to embed matplotlib in a
# GTK application
import matplotlib
matplotlib.use('GTK')
from matplotlib.backends import Figure
from matplotlib.axes import Subplot
import Numeric as numpy
import gtk
win = gtk.Window()
win.set_name("Embedding in GTK")
win.connect("destroy", gtk.mainquit)
win.set_border_width(5)
vbox = gtk.VBox(spacing=3)
win.add(vbox)
vbox.show()
f = Figure(figsize=(5,4), dpi=100)
a = Subplot(f, 111)
t = numpy.arange(0.0,3.0,0.01)
s = numpy.sin(2*numpy.pi*t)
a.plot(t,s)
f.add_axes(a)
f.show()
vbox.pack_start(f)
button = gtk.Button('Quit')
button.connect('clicked', lambda b: gtk.mainquit())
button.show()
vbox.pack_start(button)
win.show()
gtk.mainloop()
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.