forked from rootpy/rootpy
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathroot-browser
More file actions
executable file
·56 lines (40 loc) · 1.37 KB
/
Copy pathroot-browser
File metadata and controls
executable file
·56 lines (40 loc) · 1.37 KB
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
52
53
54
55
56
#!/usr/bin/env python
"""
TBrowser replacement using GTK
work in progress...
"""
import gtk as Gtk
from matplotlib.figure import Figure
from numpy import arange, sin, pi
def file_selected(filechooser):
filename = str(filechooser.get_filename())
window = Gtk.Window()
window.set_title("Browser")
window.set_border_width(5)
window.set_default_size(900, 600)
window.connect("destroy", lambda q: Gtk.main_quit())
vbox = Gtk.VBox(homogeneous=False, spacing=0)
window.add(vbox)
hpaned = Gtk.HPaned()
filechooserwidget = Gtk.FileChooserWidget()
#filechooserwidget.connect("selection-changed", file_selected)
hpaned.add1(filechooserwidget)
vbox.pack_start(hpaned, True, True, 0)
# 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
figure = Figure(figsize=(5, 4), dpi=100, facecolor='white')
a = figure.add_subplot(111)
t = arange(0.0, 3.0, 0.01)
s = sin(2 * pi * t)
a.plot(t, s)
frame = Gtk.AspectFrame()
hpaned.add2(frame)
# A scrolled window border goes outside the scrollbars and viewport
frame.set_border_width(0)
canvas = FigureCanvas(figure) # a gtk.DrawingArea
canvas.set_size_request(500, 400)
frame.add(canvas)
window.show_all()
Gtk.main()