本文整理汇总了Python中matplotlib.backends.backend_gtkagg.NavigationToolbar2GTKAgg.insert方法的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2GTKAgg.insert方法的具体用法?Python NavigationToolbar2GTKAgg.insert怎么用?Python NavigationToolbar2GTKAgg.insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_gtkagg.NavigationToolbar2GTKAgg
的用法示例。
在下文中一共展示了NavigationToolbar2GTKAgg.insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_toolbar
# 需要导入模块: from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg [as 别名]
# 或者: from matplotlib.backends.backend_gtkagg.NavigationToolbar2GTKAgg import insert [as 别名]
def make_toolbar(self):
toolbar = NavigationToolbar(self.canvas, self)
next = 8
toolitem = gtk.SeparatorToolItem()
toolitem.show()
toolbar.insert(toolitem, next); next+=1
toolitem.set_expand(False)
self.buttonFollowEvents = gtk.CheckButton ()
self.buttonFollowEvents.set_label('Auto')
self.buttonFollowEvents.show()
self.buttonFollowEvents.set_active(True)
toolitem = gtk.ToolItem()
toolitem.show()
#Rewriting this for the new gtk tooltips available in pygtk 2.12 and up
#toolitem.set_tooltip(
# toolbar.tooltips,
# 'Automatically update in response to selections in EEG', 'Private')
toolitem.set_tooltip_text('Automatically update in response to selections in EEG')
toolitem.add(self.buttonFollowEvents)
toolbar.insert(toolitem, next); next +=1
# XXX: only available in gtk 2.6
menu = gtk.MenuToolButton(gtk.STOCK_EDIT)
menu.show()
context = self.make_context_menu()
menu.set_menu(context)
#menu.set_tooltip(
# toolbar.tooltips,
# 'Set filter/detrend etc', 'Private')
menu.set_tooltip_text('Set filter/detrend etc')
toolbar.insert(menu, next); next+=1
toolitem = gtk.SeparatorToolItem()
toolitem.show()
toolbar.insert(toolitem, next)
toolitem.set_expand(False)
return toolbar
示例2: show
# 需要导入模块: from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg [as 别名]
# 或者: from matplotlib.backends.backend_gtkagg.NavigationToolbar2GTKAgg import insert [as 别名]
def show(self):
try:
if not self.packed:
self.pack_start(self.canvas, expand=True)
toolbar = NavigationToolbar(self.canvas, self.get_parent_window())
next = 8
button = gtk.Button('Lin y')
button.show()
button2 = gtk.Button('Lin x')
button2.show()
# linear/log
def clicked(button):
self.adjust_axis_margins()
self.set_axis_labels()
self.color_labels()
self.canvas.draw_idle()
self.canvas.show()
if self.ax.get_yscale() == 'log':
button.set_label('Lin y')
self.ax.set_yscale('linear')
else:
button.set_label('Log y')
self.ax.set_yscale('log')
self.show()
def clicked2(button):
self.adjust_axis_margins()
self.set_axis_labels()
self.color_labels()
self.canvas.draw_idle()
self.canvas.show()
if self.ax.get_xscale() == 'log':
button.set_label('Lin x')
self.ax.set_xscale('linear')
else:
button.set_label('Log x')
self.ax.set_xscale('log')
self.show()
button.connect('clicked', clicked)
button2.connect('clicked', clicked2)
toolitem=gtk.ToolItem()
toolitem.show()
toolitem.add(button)
toolbar.insert(toolitem, next)
next +=1
toolitem2=gtk.ToolItem()
toolitem2.show()
toolitem2.add(button2)
toolbar.insert(toolitem2, next)
self.pack_start(toolbar, expand=False)
self.packed = True
super(Figure, self).show()
except Exception, e:
print 'Exception: ', e
raise