本文整理汇总了Python中matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg.connect方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasGTKAgg.connect方法的具体用法?Python FigureCanvasGTKAgg.connect怎么用?Python FigureCanvasGTKAgg.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg
的用法示例。
在下文中一共展示了FigureCanvasGTKAgg.connect方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: WidgetsWrapper
# 需要导入模块: from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg [as 别名]
# 或者: from matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg import connect [as 别名]
class WidgetsWrapper(object):
def __init__(self):
self.widgets = gtk.glade.XML('mpl_with_glade.glade')
self.widgets.signal_autoconnect(GladeHandlers.__dict__)
self['windowMain'].connect('destroy', lambda x: gtk.main_quit())
self['windowMain'].move(10, 10)
self.figure = Figure(figsize=(8, 6), dpi=72)
self.axis = self.figure.add_subplot(111)
t = arange(0.0, 3.0, 0.01)
s = sin(2*pi*t)
self.axis.plot(t, s)
self.axis.set_xlabel('time (s)')
self.axis.set_ylabel('voltage')
self.canvas = FigureCanvas(self.figure) # a gtk.DrawingArea
self.canvas.show()
self.canvas.set_size_request(600, 400)
self.canvas.set_events(
gtk.gdk.BUTTON_PRESS_MASK |
gtk.gdk.KEY_PRESS_MASK |
gtk.gdk.KEY_RELEASE_MASK
)
self.canvas.set_flags(gtk.HAS_FOCUS | gtk.CAN_FOCUS)
self.canvas.grab_focus()
def keypress(widget, event):
print('key press')
def buttonpress(widget, event):
print('button press')
self.canvas.connect('key_press_event', keypress)
self.canvas.connect('button_press_event', buttonpress)
def onselect(xmin, xmax):
print(xmin, xmax)
span = SpanSelector(self.axis, onselect, 'horizontal', useblit=False,
rectprops=dict(alpha=0.5, facecolor='red'))
self['vboxMain'].pack_start(self.canvas, True, True)
self['vboxMain'].show()
# below is optional if you want the navigation toolbar
self.navToolbar = NavigationToolbar(self.canvas, self['windowMain'])
self.navToolbar.lastDir = '/var/tmp/'
self['vboxMain'].pack_start(self.navToolbar)
self.navToolbar.show()
sep = gtk.HSeparator()
sep.show()
self['vboxMain'].pack_start(sep, True, True)
self['vboxMain'].reorder_child(self['buttonClickMe'], -1)
def __getitem__(self, key):
return self.widgets.get_widget(key)
示例2: __init__
# 需要导入模块: from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg [as 别名]
# 或者: from matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg import connect [as 别名]
class template:
def __init__(self):
self.builder = gtk.Builder()
self.builder.add_from_file(os.path.splitext(__file__)[0]+".glade")
self.window = self.builder.get_object("window")
dic = {
"on_toolbutton_refresh_clicked" : self.generate_testdata,
"on_button1_clicked" : self.generate_testdata,
"on_vboxMain_button_press_event" : self.button_press_event,
"on_vboxMain_button_release_event" : self.button_release_event,
"on_vboxMain_drag" : self.drag_begin,
"on_vboxMain_motion_notify_event" : self.drag_begin,
"on_toolbar_clear_clicked" : self.clear_selections,
"on_toolbar_zoomin_clicked" : self.zoomin_time,
"on_toolbar_zoomout_clicked" : self.zoomout_time,
"on_go_back_clicked" : self.go_back,
"on_go_forward_clicked" : self.go_forward,
"on_toolbutton_preferences_clicked" : self.preferences_open,
"on_button_pref_apply_activate" : self.pref_apply,
"set_channel_groups" : self.set_channel_groups,
}
self.builder.connect_signals(dic)
self.create_draw_frame('none')
self.space = 0
self.generate_testdata(None)
def create_draw_frame(self,widget):
self.fig = Figure(figsize=[100,100], dpi=72)
self.canvas = FigureCanvas(self.fig)
self.canvas.connect("scroll_event", self.scroll_event)
#self.canvas.connect('button_press_event', self.button_press_event)
self.canvas.show()
self.figure = self.canvas.figure
self.axes = self.fig.add_axes([0.045, 0.05, 0.93, 0.925], axisbg='#FFFFCC')
self.vb = self.builder.get_object("vboxMain")
self.vb.pack_start(self.canvas, gtk.TRUE, gtk.TRUE)
self.vb.show()
def preferences_open(self,widget):
self.win_prefs = self.builder.get_object("window_prefs")
self.win_prefs.show()
self.channel_tree(None)
def scroll_event(self, widget, event):
if event.direction == gdk.SCROLL_UP:
direction = 1
self.space = self.space + .1*self.scalefact
else:
direction = -1
self.space = self.space - .1*self.scalefact
if self.space < 0:
self.space = 0
print 'space', self.space
print (arange(0,size(self.data2plot,1))*(self.space))
self.space_data()
self.redraw(None)
curpos = self.axes.get_position()
l1 = curpos.x0
b1 = curpos.y0
w1 = curpos.x1
h1 = curpos.y1
def space_data(self):
self.data2plot = self.data[self.tstart:self.tstop,self.chanind] + \
(arange(0,size(self.data[self.tstart:self.tstop,self.chanind],1)) * \
(self.space))
def get_cursor_position(self,event):
ap = self.axes.get_position()
x,y = self.canvas.get_width_height()
posx = ((event.x/x)-ap.x0)*(1/(ap.x1-ap.x0))
posy = ((event.y/y)-(1-ap.y0))*(1/(ap.y0-ap.y1))
self.sx = (posx*(self.time[-1]-self.time[0]))+self.time[0]
self.sy = (posy*(self.data2plot.max()-self.data2plot.min()))+self.data2plot.min()
print self.sx, self.sy
def button_press_event(self,widget,event):
self.get_cursor_position(event)
print 'button pushed',event.button,event.type
if event.type == gtk.gdk.BUTTON_PRESS:
print "single click"
if event.button == 1:
#clicked line
#self.axes.axvline(x=self.sx)
self.xstart = self.sx
elif event.type == gtk.gdk._2BUTTON_PRESS:
print "double click"
#highlight channel
#self.axes.axhspan(self.sy-1, self.sy+1, xmin=0, xmax=1, color='yellow')
elif event.type == gtk.gdk._3BUTTON_PRESS:
print "triple click. ouch, you hurt your user."
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 2:
#.........这里部分代码省略.........
示例3: band_graph
# 需要导入模块: from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg [as 别名]
# 或者: from matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg import connect [as 别名]
class band_graph(gtk.VBox):
def init(self):
toolbar = gtk.Toolbar()
toolbar.set_style(gtk.TOOLBAR_ICONS)
toolbar.set_size_request(-1, 50)
self.pack_start(toolbar, False, False, 0)
tool_bar_pos=0
save = gtk.ToolButton(gtk.STOCK_SAVE)
save.connect("clicked", self.callback_save_image)
toolbar.insert(save, tool_bar_pos)
toolbar.show_all()
tool_bar_pos=tool_bar_pos+1
self.my_figure=Figure(figsize=(5,4), dpi=100)
self.canvas = FigureCanvas(self.my_figure) # a gtk.DrawingArea
self.canvas.figure.patch.set_facecolor('white')
self.canvas.set_size_request(600, 400)
self.canvas.show()
self.pack_start(self.canvas, False, False, 0)
self.canvas.connect('key_press_event', self.on_key_press_event)
self.show_all()
def on_key_press_event(self,widget, event):
keyname = gtk.gdk.keyval_name(event.keyval)
if keyname == "c":
if event.state == gtk.gdk.CONTROL_MASK:
self.do_clip()
self.canvas.draw()
def do_clip(self):
print "doing clip"
snap = self.my_figure.canvas.get_snapshot()
pixbuf = gtk.gdk.pixbuf_get_from_drawable(None, snap, snap.get_colormap(),0,0,0,0,snap.get_size()[0], snap.get_size()[1])
clip = gtk.Clipboard()
clip.set_image(pixbuf)
def callback_save_image(self, widget):
dialog = gtk.FileChooserDialog("Save plot",
None,
gtk.FILE_CHOOSER_ACTION_SAVE,
(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_SAVE, gtk.RESPONSE_OK))
dialog.set_default_response(gtk.RESPONSE_OK)
dialog.set_action(gtk.FILE_CHOOSER_ACTION_CREATE_FOLDER)
filter = gtk.FileFilter()
filter.set_name("png")
filter.add_pattern("*.png")
dialog.add_filter(filter)
response = dialog.run()
if response == gtk.RESPONSE_OK:
self.my_figure.savefig(dialog.get_filename())
elif response == gtk.RESPONSE_CANCEL:
print 'Closed'
dialog.destroy()
def set_data_file(self,file):
self.optical_mode_file=os.path.join(os.getcwd(),"light_dump",file)
def draw_graph(self):
self.layer_end=[]
self.layer_name=[]
n=0
self.my_figure.clf()
ax1 = self.my_figure.add_subplot(111)
ax2 = ax1.twinx()
x_pos=0.0
layer=0
color =['r','g','b','y','o','r','g','b','y','o']
start=0.0
for i in range(0,epitaxy_get_layers()):
if epitaxy_get_electrical_layer(i)=="none":
start=start-epitaxy_get_width(i)
else:
break
print "START=",start
start=start*1e9
x_pos=start
for i in range(0,epitaxy_get_layers()):
label=epitaxy_get_mat_file(i)
layer_ticknes=epitaxy_get_width(i)
layer_material=epitaxy_get_mat_file(i)
delta=float(layer_ticknes)*1e9
if epitaxy_get_electrical_layer(i)=="none":
mat_file=os.path.join(os.getcwd(),'materials',layer_material,'mat.inp')
myfile = open(mat_file)
self.mat_file_lines = myfile.readlines()
#.........这里部分代码省略.........
示例4: canvas
# 需要导入模块: from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg [as 别名]
# 或者: from matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg import connect [as 别名]
class Gtk_NetworkCanvas:
"""Gtk_NetworkCanvas class.
This class contains the canvas to draw the topology. It implements event listener and zoom.
Parameters
----------
canvas : the gtk canvas to draw
adjustement : used for zoom scroll bar
zoom_scale : a scroll bar to zoom
redraw : a button to redraw the graph
popup : a popup for interaction on right click
bRefresh : bool. if True enable refresh with do_refresh function
corners : the limit of the canvas drawing area
press : bool. True if mouse click on canvas (used for zoom)
x_old, y_old : position for zoom
"""
def __init__(self):
fig = plt.figure(num=None, facecolor='w', edgecolor='k')
plt.axis('off')
plt.subplots_adjust(left=0., right=1., bottom=0., top=1., wspace=0.2, hspace=0.2)
self.canvas = FigureCanvas(fig)
self.canvas.add_events(
gtk.gdk.EXPOSURE_MASK | gtk.gdk.LEAVE_NOTIFY_MASK | gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.POINTER_MOTION_HINT_MASK | gtk.gdk.BUTTON_RELEASE_MASK)
self.canvas.connect("motion_notify_event", self.on_motion)
self.canvas.connect("button-press-event", self.on_click)
self.canvas.connect("button-release-event", self.on_release)
self.canvas.connect("scroll-event", self.on_scroll)
self.canvas.connect("leave-notify-event", self.on_lose_focus)
self.adjustement = gtk.Adjustment(0.0, 0.0, 100.0, 1.0, 1.0, 1.0)
self.adjustement_signal = self.adjustement.connect("value-changed", self.on_zoom_changed)
self.zoom_scale = gtk.HScale(self.adjustement)
self.zoom_scale.set_draw_value(False)
self.zoom_value = 0.0
self.redraw = gtk.Button("Redraw")
self.redraw.connect("clicked", self.on_redraw)
self.hbox = gtk.HBox()
self.hbox.pack_start(self.zoom_scale, True, True, 0)
self.hbox.pack_end(self.redraw, False, False, 0)
self.vbox = gtk.VBox()
self.vbox.pack_start(self.canvas, True, True, 0)
self.vbox.pack_end(self.hbox, False, False, 0)
self.popup = Gtk_NewtworkPopupMenu()
self.bRefresh = True
self.corners = None
self.press = False
self.x_old = 0
self.y_old = 0
self.bg_img = None
def on_click(self, widget, event):
"""Event listener : click
If double left click :
- on edge, show edges rules
- on firewall, show firewall conf
- on interface, add note
If left click :
- on edge, show message
- on firewall, show message interaction firewall
- on interface, show message interaction interface
- else move x/y limit drawing area
If right click :
- on edge, show edge menu
- on firewall, show firewall menu
- on interface, show interface menu
- else show canvas menu
"""
if event.button == 1 and event.type == gtk.gdk._2BUTTON_PRESS:
dbl_click = False
dbl_click |= self.on_dblclick_edge()
dbl_click |= self.on_dblclick_node()
if not dbl_click:
Gtk_Main.Gtk_Main().lateral_pane.help_message.change_message(Gtk_Message.TOPOLOGY_MESSAGE)
if event.button == 3 and event.type == gtk.gdk.BUTTON_PRESS:
right_click = False
right_click |= self.on_right_click_edge(event)
right_click |= self.on_right_click_node(event)
if not right_click:
Gtk_Main.Gtk_Main().lateral_pane.help_message.change_message(Gtk_Message.ON_BACKGROUND_CLICK)
self.popup.popup_clear(event)
if event.button == 1 and event.type == gtk.gdk.BUTTON_PRESS:
left_click = False
left_click |= self.on_left_click_edge()
left_click |= self.on_left_click_node()
if not left_click:
self.press = True
self.x_old = event.x
self.y_old = event.y
Gtk_Main.Gtk_Main().lateral_pane.help_message.change_message(Gtk_Message.TOPOLOGY_MESSAGE)
return True
def on_dblclick_edge(self):
"""Show interface rules"""
def get_firewall(x, y):
#.........这里部分代码省略.........
示例5: __init__
# 需要导入模块: from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg [as 别名]
# 或者: from matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg import connect [as 别名]
class _Matplotlib:
def __init__ (self, pp, progressbar):
self.pp = pp
self.pb = progressbar
self.figure = pylab.figure ()
self.canvas = FigureCanvas (self.figure)
self.toolbar = NavigationToolbar (self.canvas, pp ["MainWindow"])
self.pp ["BoxPlotArea"].pack_start (self.toolbar, expand = False, fill = False)
self.pp ["BoxPlotArea"].pack_start (self.canvas , expand = True, fill = True)
self.canvas.connect ("button_press_event", self.on_button_press_event)
self.l = 0
self.dataAreOld = True
self.pathLength = None
self.pathId = None
self.dl = None
def get_x_cursor_position(self,event):
gca = self.figure.gca ()
ap = gca.get_position ()
xmin, xmax = gca.get_xbound ()
x,y = self.canvas.get_width_height()
posx = ((event.x/x)-ap.x0)*(1/(ap.x1-ap.x0))
sx = (posx*(xmax - xmin)) + xmin
return sx
def on_button_press_event (self, w, event):
if not event.type == gtk.gdk._2BUTTON_PRESS \
or not event.button == 1:
return False
l = self.get_x_cursor_position(event)
self.pp ["PathScale"].set_value (l)
return True
def selectData (self, x, ys):
self.x = x
self.ys = ys
if not self.pathLength == self.pp.pathLength \
or not self.pathId == self.pp.pathId \
or not self.dl == self.pp.dl:
self.dataAreOld = True
self.pathId = self.pp.pathId
self.pathLength = self.pp.pathLength
self.dl = self.pp.dl
self.l = 0
self.datas = list ()
else:
self.dataAreOld = False
def init_pulse (self):
if self.dataAreOld:
self.pb.set_text ("Generating datas...")
self.pb.set_fraction (0)
glib.idle_add (self.getData_pulse)
else:
glib.idle_add (self.genPlot_pulse)
return False
def getData_pulse (self):
d = [ self.l, ]
d.extend (self.pp.client.problem.configAtParam (self.pathId, self.l))
self.datas.append (d)
self.l += self.dl
if self.l < self.pathLength:
self.pb.set_fraction (self.l / self.pathLength)
return True
else:
self.pb.set_fraction (1)
glib.idle_add (self.genPlot_pulse)
return False
def genPlot_pulse (self):
self.pb.set_text ("Generating plots...")
self.npdatas = np.matrix (self.datas)
self.figure.clf ()
gca = pylab.gca ()
for elt in self.ys:
pylab.plot (self.npdatas [:,self.x[1]], self.npdatas [:,elt[1]], label=elt[0])
gca.set_xlabel (self.x[0])
pylab.legend (loc='best')
self.canvas.draw ()
self.pb.set_text ("Idle")
return False
示例6: Plot
# 需要导入模块: from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg [as 别名]
# 或者: from matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg import connect [as 别名]
class Plot(gtk.HBox):
""" Base class for LivePlots. This class is an abstract class. In addition
to inheriting from this class it is also required to take the following
actions to achieve a functioning plot:
Bla bla bla
"""
def __init__(self, dpi=100, x_pixel_size=500, y_pixel_size=400):
gtk.HBox.__init__(self)
# If the class is being reinitialized, we need to remove the old plot
[self.remove(child) for child in self.get_children()]
self.vbox = gtk.VBox()
self.pack_start(self.vbox)
# this is bad with labels, I have to figure out why
self.connect('size_allocate', self._full_update)
self.fig = Figure(figsize=(float(x_pixel_size)/dpi,
float(y_pixel_size)/dpi),
dpi=dpi)
self.fig.set_facecolor('white')
self.canvas = FigureCanvasGTKAgg(self.fig)
self.ax = self.fig.add_subplot(111)
self.vbox.pack_end(self.canvas)
self.canvas.connect('button_press_event', self._on_mouse_click)
self.first_update = True
self.settings = {}
self.n_lines = None
#self.line_styles = None
#self.line_colors = None
self.lines = None
self.saved_window_size = None
self.background = None
self.auto_x_scale = False
self.auto_y_scale = False
def _change_settings_common(self, number_of_lines, **kw):
""" Change the subset of settings that are common for all plots """
self.settings.update(kw)
self.n_lines = number_of_lines
self.line_styles = kw['line_styles'] if kw.has_key('line_styles')\
else ['']*self.n_lines
self.line_colors = kw['line_colors'] if kw.has_key('line_colors')\
else self._get_colors(self.n_lines)
self.lines = None
self.background = None
if self.settings['legends'] is not None:
c = matplotlib.colors.ColorConverter()
colors = [matplotlib.colors.rgb2hex(c.to_rgb(color))
for color in self.line_colors]
self.legends = Legends(self.settings['legends'],
colors,
self.settings['legend_placement'],
self.settings['legend_cols'])
if self.settings['legend_placement'] == 'top':
self.vbox.pack_end(self.legends, expand=False)
else:
self.pack_end(self.legends, expand=False)
def _on_mouse_click(self, widget, event):
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
b1 = gtk.MenuItem("A button")
b2 = gtk.MenuItem("Another")
menu = gtk.Menu()
menu.append(b1)
menu.append(b2)
b1.show()
b2.show()
menu.popup(None, None, None, event.button, event.time)
def _update_bounds(self):
return self._update_x_bounds() or self._update_y_bounds()
def _update_x_bounds(self):
if not self.auto_x_scale:
return False
def _update_y_bounds(self):
modified = False
if not self.auto_y_scale:
return modified
# Combine data (double loop), sort out None and get min/max
y_min = min([inner for outer in self.y for inner in outer\
if inner is not None])
y_max = max([inner for outer in self.y for inner in outer\
if inner is not None])
delta = y_max - y_min
if delta < 1E-10:
return modified
br = 0.2
if y_min < self.settings['y_bounds'][0]:
self.settings['y_bounds'] =\
(y_min-br*delta, self.settings['y_bounds'][1])
modified = True
elif y_min > self.settings['y_bounds'][0] + br*delta:
self.settings['y_bounds'] =\
#.........这里部分代码省略.........
示例7: __init__
# 需要导入模块: from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg [as 别名]
# 或者: from matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg import connect [as 别名]
class setup_gui:
def __init__(self):
self.builder = gtk.Builder()
self.builder.add_from_file(os.path.splitext(__file__)[0]+".glade")
self.window = self.builder.get_object("window")
dic = {
"on_toolbutton_refresh_clicked" : self.generate_testdata,
"on_button1_clicked" : self.generate_testdata,
"on_vboxMain_button_press_event" : self.button_press_event,
"on_vboxMain_button_release_event" : self.button_release_event,
"on_vboxMain_drag" : self.drag_begin,
"on_vboxMain_motion_notify_event" : self.drag_begin,
"on_toolbar_clear_clicked" : self.clear_selections,
"on_toolbar_zoomin_clicked" : self.zoomin_time,
"on_toolbar_zoomout_clicked" : self.zoomout_time,
"on_go_back_clicked" : self.page_back,
"on_go_forward_clicked" : self.page_forward,
"on_toolbutton_setup_toggled" : self.preferences_open,
"on_button_channel_apply_clicked" : self.channel_selection_apply,
"set_channel_groups" : self.set_channel_groups,
"showpopupmenu" : self.showpopupmenu,
"on_toolbar_plot_clicked" : self.plot_contour,
"on_plot_contour_activate" : self.plot_contour,
"on_button_delete_selection_clicked" : self.event_selection_delete,
"gtk_widget_hide" : self.hideinsteadofdelete,
"on_button_display_apply_clicked": self.display_apply,
"on_go_up_clicked" : self.page_up,
"on_go_down_clicked" : self.page_down,
"on_toolbutton_load_clicked" : self.load_data,
"on_menu_offset_correct_clicked" : self.offset_correct,
"on_button_epoch_clicked" : self.add_selections_to_event_process,
"on_store_event_clicked" : self.store_event,
"on_menu_save_noise_activate" : self.store_noise,
"on_menu_save_event_activate" : self.store_event,
"on_key_press_event" : self.key_press_event,
}
self.builder.connect_signals(dic)
try: self.prefs = readwrite.readdata(os.getenv('HOME')+'/.pymeg.pym')
except IOError: self.prefs = {}; readwrite.writedata(self.prefs, os.getenv('HOME')+'/.pymeg')
try:
self.line_r,self.line_g,self.line_b = self.prefs['LineColor'][0],self.prefs['LineColor'][1],self.prefs['LineColor'][2]
self.back_r,self.back_g,self.back_b = self.prefs['BackColor'][0],self.prefs['BackColor'][1],self.prefs['BackColor'][2]
except:
self.line_r,self.line_g,self.line_b = 1.,1.,1.
self.back_r,self.back_g,self.back_b = .9,.9,.9
self.color = (self.line_r,self.line_g,self.line_b)
self.create_draw_frame('none')
self.create_spec_frame('none')
self.create_csd_frame('none')
self.space = 0
#self.generate_testdata(None)
self.preferences_open(None)
def printtest(self,widget):
print 'something'
def store_noise(self,widget):
print widget,'wid',widget.get_parent().get_name()
self.callback(widget)
def store_event(self,widget):
print widget,'wid',widget.get_parent().get_name()
self.callback(widget)
def create_draw_frame(self,widget):
self.fig = Figure(figsize=[100,100], dpi=40)
self.canvas = FigureCanvas(self.fig)
self.canvas.connect("scroll_event", self.scroll_event)
self.canvas.connect("key-press-event", self.key_press_event)
#self.canvas.connect('button_press_event', self.button_press_event)
self.canvas.show()
self.figure = self.canvas.figure
self.axes = self.fig.add_axes([0.045, 0.05, 0.93, 0.925], \
axisbg=(self.back_r,self.back_g,self.back_b))
#axisbg='#FFFFCC')
self.vb = self.builder.get_object("vbox3")
self.vb.pack_start(self.canvas, gtk.TRUE, gtk.TRUE)
self.vb.show()
def create_spec_frame(self,widget):
self.specfig = Figure(figsize=[10,10], dpi=40)
self.specfig.text(0.25,0.5,'Middle Click Channel for Specgram',\
fontsize=20)
self.speccanvas = FigureCanvas(self.specfig)
self.speccanvas.show()
self.specfigure = self.speccanvas.figure
self.specaxes = self.specfig.add_axes([0.045, 0.05, 0.93, 0.925], \
axisbg=(self.back_r,self.back_g,self.back_b))
#self.specaxes.axis('off')
self.vb2 = self.builder.get_object("vbox8")
self.vb2.pack_end(self.speccanvas, gtk.TRUE, gtk.TRUE)
self.vb2.show()
def create_csd_frame(self,widget):
self.csdfig = Figure(figsize=[10,10], dpi=40)
self.csdfig.text(0.25,0.5,'Middle Click Channel for CSD',fontsize=20)
#.........这里部分代码省略.........