本文整理汇总了Python中matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2WxAgg.__init__方法的具体用法?Python NavigationToolbar2WxAgg.__init__怎么用?Python NavigationToolbar2WxAgg.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg
的用法示例。
在下文中一共展示了NavigationToolbar2WxAgg.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg import __init__ [as 别名]
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)
示例2: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg import __init__ [as 别名]
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__
# 需要导入模块: from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg import __init__ [as 别名]
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)
示例4: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg import __init__ [as 别名]
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()
示例5: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg import __init__ [as 别名]
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()
示例6: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg import __init__ [as 别名]
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)
示例7: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg import __init__ [as 别名]
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())
示例8: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg import __init__ [as 别名]
def __init__(self, plotCanvas, multPlots=False, allowselect=False):
NavigationToolbar.__init__(self, plotCanvas)
#self.ClearTools()
# delete the toolbar button we don't want
if (not multPlots):
CONFIGURE_SUBPLOTS_TOOLBAR_BTN_POSITION = 8
self.DeleteToolByPos(CONFIGURE_SUBPLOTS_TOOLBAR_BTN_POSITION)
#self.AddSimpleTool(self.ON_CUSTOM_LEFT, scroll_left.GetBitmap(), ' Pan to the left', 'Pan graph to the left')
#self.AddSimpleTool(self.ON_CUSTOM_RIGHT, scroll_right.GetBitmap(), 'Pan to the right', 'Pan graph to the right')
#wx.EVT_TOOL(self, self.ON_CUSTOM_LEFT, self._on_custom_pan_left)
#wx.EVT_TOOL(self, self.ON_CUSTOM_RIGHT, self._on_custom_pan_right)
if allowselect:
"""self.select_tool = self.AddSimpleTool(self.ON_LASSO_SELECT, select.GetBitmap(), 'Lasso Select',
'Select datavalues from the graph', isToggle=True)
self.zoom_to_data = self.AddSimpleTool(self.ON_ZOOM_DATA_SELECT, zoom_data.GetBitmap(), 'Zoom to Data',
'Zoom to data without NoDataValues')
wx.EVT_TOOL(self, self.ON_LASSO_SELECT, self.on_toggle_lasso_tool)
wx.EVT_TOOL(self, self.ON_ZOOM_DATA_SELECT, self.on_toggle_zoom_data_tool)"""
# Get the ids for the existing tools
self.pan_tool = self.FindById(self.wx_ids['Pan'])
self.zoom_tool = self.FindById(self.wx_ids['Zoom'])
self.select_tool=self.FindById(self.wx_ids['Select'])
self.zoom_to_data = self.FindById(self.wx_ids['Zoom to Data'])
wx.EVT_TOOL(self, self.zoom_tool.Id, self.on_toggle_pan_zoom)
wx.EVT_TOOL(self, self.pan_tool.Id, self.on_toggle_pan_zoom)
self.lassoAction = None
self.select_tool.Enable(False)
self.zoom_to_data.Enable(False)
else:
ZOOM_DATA_BTN_POSITION = 1
SELECT_DATA_BTN_POSTITION = self.ToolsCount-1
self.DeleteToolByPos(SELECT_DATA_BTN_POSTITION)
self.DeleteToolByPos(ZOOM_DATA_BTN_POSITION)
self.SetToolBitmapSize(wx.Size(16, 16))
#msg = wx.StaticText(self, -1, '|')
#msg.SetForegroundColour((108, 123, 139))
#self.AddControl(msg)
self.AddSeparator()
self.msg = wx.StaticText(self, -1, "")
self.AddControl(self.msg)
self.Realize()
示例9: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg import __init__ [as 别名]
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__
# 需要导入模块: from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg import __init__ [as 别名]
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)
示例11: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg import __init__ [as 别名]
def __init__(self, plotCanvas):
# create the default toolbar
NavigationToolbar.__init__(self, plotCanvas)
# find where icons are located
path = os.path.dirname(__file__)
icon_file = os.path.join(path, 'data-export-icon.png')
self.AddSimpleTool(self.EXPORT_DATA, _load_bitmap(icon_file),
'Export data', 'Export current data to file')
wx.EVT_TOOL(self, self.EXPORT_DATA, self._on_export_data)
示例12: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg import __init__ [as 别名]
def __init__(self,canvas_,parent_):
self.toolitems = (
('Home', 'Reset original view', 'home', 'home'),
('Pan', 'Pan axes with left mouse, zoom with right', 'move', 'pan'),
('Zoom', 'Zoom to rectangle', 'zoom_to_rect', 'zoom'),
(None, None, None, None),
('Save', 'Save the figure', 'filesave', 'save_figure'),
)
NavigationToolbar.__init__(self,canvas_)
示例13: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg import __init__ [as 别名]
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()
示例14: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg import __init__ [as 别名]
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)
示例15: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg import __init__ [as 别名]
def __init__(self, canvas):
NavToolbar.__init__(self, canvas)
# Load customized icon image
save_icon_fp = iconpath('exportplotdata.png')
save_icon = wx.Bitmap(save_icon_fp)
# Add new buttons
self.AddSimpleTool(DATA_SAVE_ID,
save_icon,
'Export plot data', 'Export plot data to file')
return