-
Notifications
You must be signed in to change notification settings - Fork 1
/
top_volume.py
47 lines (36 loc) · 1.52 KB
/
top_volume.py
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
#!/usr/bin/env python
from utilities import panel_size
from time_panel import TimeControlPanel
from pylab import * #includes arange
import wx
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.backends.backend_wx import NavigationToolbar2Wx
from matplotlib.figure import Figure
class VolumePanel(wx.Panel):
def __init__( self, parent):
wx.Panel.__init__( self, parent)
# initialize matplotlib stuff
self.figure = Figure()
self.canvas = FigureCanvas( self, -1, self.figure )
self.ax = self.figure.add_subplot(111)
#print "Top Applications ..."
self.timeControlPanel = TimeControlPanel(self)
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.sizer.Add(self.timeControlPanel, 0, wx.LEFT | wx.TOP | wx.GROW)
self.sizer.Add(self.canvas, 0, wx.LEFT | wx.TOP | wx.GROW)
self.SetSizer(self.sizer)
self.Fit()
self.SetSize(panel_size)
self.add_toolbar() # comment this out for no toolbar
def add_toolbar(self):
self.toolbar = NavigationToolbar2Wx(self.canvas)
self.toolbar.Realize()
if wx.Platform == '__WXMAC__':
self.SetToolBar(self.toolbar)
else:
tw, th = self.toolbar.GetSizeTuple()
fw, fh = self.canvas.GetSizeTuple()
self.toolbar.SetSize(wx.Size(fw, th))
self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
# update the axes menu on the toolbar
self.toolbar.update()