本文整理汇总了Python中matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg类的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2WxAgg类的具体用法?Python NavigationToolbar2WxAgg怎么用?Python NavigationToolbar2WxAgg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NavigationToolbar2WxAgg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, canvas, main):
self.main = main
navId = wx.NewId()
NavigationToolbar2WxAgg.__init__(self, canvas)
self.AddSimpleTool(navId, _load_bitmap("subplots.png"), "Range", "Set plot range")
wx.EVT_TOOL(self, navId, self.on_range)
示例2: __init__
def __init__(self, plotCanvas):
# create the default toolbar
NavigationToolbar2WxAgg.__init__(self, plotCanvas)
# remove the unwanted button
POSITION_OF_CONFIGURE_SUBPLOTS_BTN = 7
self.DeleteToolByPos(POSITION_OF_CONFIGURE_SUBPLOTS_BTN)
示例3: __init__
def __init__(self, canvas, cankill):
NavigationToolbar2WxAgg.__init__(self, canvas)
self.canvas = canvas
#setattr(self,'datajours', getattr(canvas.GetParent(),'datajours'))
for name in dir(canvas.GetParent()):
#print "name= :", name
if name in ["datayear","vg0","vg0_2","year","nyear","month","day","nday","pm10","aot1020"]:
setattr(self,name,getattr(canvas.GetParent(),name))
# for simplicity I'm going to reuse a bitmap from wx, you'll
# probably want to add your own.
self.ON_PREVIOUS = wx.NewId()
self.ON_NEXT = wx.NewId()
self.ON_LISTE = wx.NewId()
self.AddSimpleTool(self.ON_PREVIOUS, _load_bitmap('stock_left.xpm'), 'Courbe precedente', 'Courbe precedente')
self.AddSimpleTool(self.ON_NEXT, _load_bitmap('stock_right.xpm'), 'Courbe suivante', 'Courbe suivante')
self.AddSimpleTool(self.ON_LISTE, _load_bitmap('stock_up.xpm'), 'Liste par date', 'Liste par date')
wx.EVT_TOOL(self, self.ON_PREVIOUS, self._on_previous)
wx.EVT_TOOL(self, self.ON_NEXT, self._on_next)
wx.EVT_TOOL(self, self.ON_LISTE, self._on_liste)
self.inityear()
self.draw()
示例4: __init__
def __init__(self, canvas, cankill):
NavigationToolbar2WxAgg.__init__(self, canvas)
# for simplicity I'm going to reuse a bitmap from wx, you'll
# probably want to add your own.
self.AddSimpleTool(self.ON_CUSTOM, _load_bitmap("stock_left.xpm"), "Click me", "Activate custom contol")
EVT_TOOL(self, self.ON_CUSTOM, self._on_custom)
示例5: __init__
def __init__(self, frame_object):
""" Constructor for toolbar object
@type self: Toolbar
@type frame_object: MainFrame
the frame object that the toolbar will be in/part of
@rtype: None
"""
NavigationToolbar2WxAgg.__init__(self, frame_object.canvas)
self.frame_object = frame_object
# Deleting unwanted icons in standard toolbar
self.DeleteToolByPos(8)
self.DeleteToolByPos(1)
self.DeleteToolByPos(1)
self.InsertSeparator(6)
self.InsertSeparator(6)
self.AddSimpleTool(self.ON_PREVIOUS, _load_bitmap('back.png'),
'Previous Run', 'Activate custom control')
wx.EVT_TOOL(self, self.ON_PREVIOUS, self._on_previous)
self.AddSimpleTool(self.ON_NEXT, _load_bitmap('forward.png'),
'Next Run', 'Activate custom control')
wx.EVT_TOOL(self, self.ON_NEXT, self._on_next)
self.AddSimpleTool(self.ON_EXTRACT, _load_bitmap('filesave.png'),
'Save to Excel', 'Activate custom control')
wx.EVT_TOOL(self, self.ON_EXTRACT, self._on_extract)
示例6: __init__
def __init__(self, canvas, cankill):
NavigationToolbar2WxAgg.__init__(self, canvas)
# for simplicity I'm going to reuse a bitmap from wx, you'll
# probably want to add your own.
self.ON_PREVIOUS = wx.NewId()
self.ON_NEXT = wx.NewId()
self.ON_LISTE = wx.NewId()
self.AddSimpleTool(self.ON_PREVIOUS, _load_bitmap('stock_left.xpm'), 'Courbe precedente', 'Courbe precedente')
self.AddSimpleTool(self.ON_NEXT, _load_bitmap('stock_right.xpm'), 'Courbe suivante', 'Courbe suivante')
self.AddSimpleTool(self.ON_LISTE, _load_bitmap('stock_up.xpm'), 'Liste par date', 'Liste par date')
wx.EVT_TOOL(self, self.ON_PREVIOUS, self._on_previous)
wx.EVT_TOOL(self, self.ON_NEXT, self._on_next)
wx.EVT_TOOL(self, self.ON_LISTE, self._on_liste)
self.diryears = datayears
print self.diryears
#keys_sort = self.diryears.keys()
#keys_sort.sort()
#self.premyear = self.diryears[keys_sort[0]]
#self.premyear = datayears[0]
self.premyear = 2005
#self.deryear = self.diryears[keys_sort[len(keys_sort)-1]]
#self.deryear = datayears[len(datayears)-1]
self.deryear = 2012
self.njour = self.premyear
self.compteuryear = 0
self.prepdata()
self.draw()
示例7: __init__
def __init__(self, plotCanvas):
NavigationToolbar2WxAgg.__init__(self, plotCanvas)
# self.SetToolBitmapSize(wx.Size(10,10))
# delete unwanted tools
self.DeleteToolByPos(6) # Configure subplots
self.DeleteToolByPos(3) # Pan
self.Realize()
示例8: __init__
def __init__(self, plot_canvas):
NavigationToolbar2WxAgg.__init__(self, plot_canvas)
#Delete home tool
#TODO add after history clear is added at each plot_refresh
self.DeleteToolByPos(0)
#add refresh plot button
self.AddSimpleTool(self.ON_CUSTOM, _load_bitmap('stock_refresh.xpm'),
'Click me', 'Activate custom control')
wx.EVT_TOOL(self, self.ON_CUSTOM, self._on_custom)
示例9: __init__
def __init__(self, canvas, panel, settings, callBackHideOverlay):
self.panel = panel
self.settings = settings
self.callBackHideOverlay = callBackHideOverlay
self.plot = None
self.extraTools = []
self.panPos = None
NavigationToolbar2WxAgg.__init__(self, canvas)
if matplotlib.__version__ >= '1.2':
panId = self.wx_ids['Pan']
else:
panId = self.FindById(self._NTB2_PAN).GetId()
self.ToggleTool(panId, True)
self.pan()
self.__add_spacer()
liveId = wx.NewId()
self.AddCheckTool(liveId, load_bitmap('auto_refresh'),
shortHelp='Real time plotting\n(slow and buggy)')
self.ToggleTool(liveId, settings.liveUpdate)
wx.EVT_TOOL(self, liveId, self.__on_check_update)
gridId = wx.NewId()
self.AddCheckTool(gridId, load_bitmap('grid'),
shortHelp='Toggle plot grid')
self.ToggleTool(gridId, settings.grid)
wx.EVT_TOOL(self, gridId, self.__on_check_grid)
peakId = wx.NewId()
self.AddCheckTool(peakId, load_bitmap('peak'),
shortHelp='Label peak')
self.ToggleTool(peakId, settings.annotate)
wx.EVT_TOOL(self, peakId, self.__on_check_peak)
self.__add_spacer()
self.autoFId = wx.NewId()
self.AddCheckTool(self.autoFId, load_bitmap('auto_f'),
shortHelp='Auto range frequency')
self.ToggleTool(self.autoFId, settings.autoF)
wx.EVT_TOOL(self, self.autoFId, self.__on_check_auto_f)
self.autoLId = wx.NewId()
self.AddCheckTool(self.autoLId, load_bitmap('auto_l'),
shortHelp='Auto range level')
self.ToggleTool(self.autoLId, settings.autoL)
wx.EVT_TOOL(self, self.autoLId, self.__on_check_auto_l)
self.autoTId = None
self.maxId = None
self.minId = None
self.avgId = None
self.varId = None
self.colourId = None
示例10: __init__
def __init__(self, canvas, tools=('Home', 'Pan', 'Zoom', 'Save')):
NavigationToolbar2WxAgg.__init__(self, canvas)
i = 0
for pos, tool in enumerate(self.toolitems):
if tool[0] not in tools:
self.DeleteToolByPos(pos-i)
i+=1
self.AddSimpleTool(self.ON_CONFIG, wx.Bitmap(basedir+'/images/preferences-system-mpl.png'),
'Customize', 'Customize')
wx.EVT_TOOL(self, self.ON_CONFIG, self._on_config)
示例11: __init__
def __init__(self, canvas):
NavigationToolbar2WxAgg.__init__(self,canvas)
# # In mpl 1.2 the Toolbar is restructured which requires a hack
# if int(matplotlib.__version__.split('.')[1]) >= 2:
# self._NTB2_PAN = self.wx_ids['Pan']
# self._NTB2_ZOOM = self.wx_ids['Zoom']
# self._CHECK_TOOLS = (self._NTB2_PAN,self._NTB2_ZOOM,self._LINESELECT,self._PIXELINSPECTOR)
self.canvas = canvas
示例12: __init__
def __init__(self, canvas, cankill):
NavigationToolbar2WxAgg.__init__(self, canvas)
# for simplicity I'm going to reuse a bitmap from wx, you'll
# probably want to add your own.
self.AddSimpleTool(self.ON_CUSTOM, _load_bitmap('stock_left.xpm'),
'Click me', 'Activate custom contol')
#self.AddSimpleTool(self.ON_CUSTOM, _load_bitmap('stock_left.xpm'),
#'Click me', 'Save to PDF format')
wx.EVT_TOOL(self, self.ON_CUSTOM, self._on_custom)
#wx.EVT_TOOL(self, self.ON_SAVETOPDF, self._on_savetopdf)
self.canvas = canvas
示例13: __init__
def __init__(self, canvas, cankill):
NavigationToolbar2WxAgg.__init__(self, canvas)
# for simplicity I'm going to reuse a bitmap from wx, you'll
# probably want to add your own.wx.ART_FOLDER_OPEN
#wx.ArtProvider.GetBitmap(wx.ART_FOLDER_OPEN) is the stock icons command
self.AddSimpleTool(self.ON_CUSTOM, wx.ArtProvider.GetBitmap(wx.ART_FOLDER_OPEN),
'Plot measurement', 'Plot an XML data file')
wx.EVT_TOOL(self, self.ON_CUSTOM, self._on_custom)
self.AddSimpleTool(self.ON_CUSTOM, wx.ArtProvider.GetBitmap(wx.ART_FOLDER_OPEN),
'Click me', 'Activate custom contol')
示例14: MPLPanel
class MPLPanel(wx.Panel):
def __init__(self, *args, **kwargs):
super(MPLPanel, self).__init__(*args, **kwargs)
# Setup the canvas
self.dpi = 100
self.fig = Figure((3.0, 2.0), dpi=self.dpi)
self.ax1 = None
self.ax2 = None
self.canvas = FigCanvas(self, -1, self.fig)
self.data = []
# Setup the toolbar/statustextctrl
self.toolbar = NavigationToolbar(self.canvas)
self.toolbar.dynamic_update()
self.testButton = wx.Button(self.toolbar, label="Pause")
self.toolbar.AddControl(self.testButton)
self.toolbar.AddSeparator()
self.statusctrl = wx.StaticText(self.toolbar, style=wx.TE_READONLY, size=wx.Size(300, 25))
self.toolbar.AddControl(self.statusctrl)
# Do the layout
panelvbox = wx.BoxSizer(wx.VERTICAL)
panelvbox.Add(self.canvas, 1, flag=wx.EXPAND | wx.GROW | wx.ALL)
panelvbox.Add(self.toolbar, 0, flag=wx.EXPAND | wx.GROW | wx.ALL)
self.SetSizer(panelvbox)
panelvbox.Fit(self)
self.canvas.draw()
示例15: __init__
def __init__(self, canvas, cankill):
NavigationToolbar.__init__(self, canvas)
# for simplicity I'm going to reuse a bitmap from wx, you'll
# probably want to add your own.
tool = self.AddTool(wx.ID_ANY, 'Click me', _load_bitmap('back.png'),
'Activate custom contol')
self.Bind(wx.EVT_TOOL, self._on_custom, id=tool.GetId())