本文整理汇总了Python中cbook.Stack.back方法的典型用法代码示例。如果您正苦于以下问题:Python Stack.back方法的具体用法?Python Stack.back怎么用?Python Stack.back使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cbook.Stack
的用法示例。
在下文中一共展示了Stack.back方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from cbook import Stack [as 别名]
# 或者: from cbook.Stack import back [as 别名]
class NavigationToolbar2:
"""
Base class for the navigation cursor, version 2
backends must implement a canvas that handles connections for
'button_press_event' and 'button_release_event'. See
FigureCanvas.connect for more information
They must also define
* save_figure - save the current figure
* set_cursor - if you want the pointer icon to change
* _init_toolbar - create your toolbar widget
* draw_rubberband (optional) : draw the zoom to rect
"rubberband" rectangle
* press : (optional) whenever a mouse button is pressed, you'll be
notified with the event
* release : (optional) whenever a mouse button is released,
you'll be notified with the event
* dynamic_update (optional) dynamically update the window while
navigating
* set_message (optional) - display message
* set_history_buttons (optional) - you can change the history
back / forward buttons to indicate disabled / enabled state.
That's it, we'll do the rest!
"""
def __init__(self, canvas):
self.canvas = canvas
# a dict from axes index to a list of view limits
self._views = Stack()
self._positions = Stack() # stack of subplot positions
self._xypress = None # the location and axis info at the time of the press
self._idPress = None
self._idRelease = None
self._active = None
self._lastCursor = None
self._init_toolbar()
self._idDrag=self.canvas.mpl_connect('motion_notify_event', self.mouse_move)
self._button_pressed = None # determined by the button pressed at start
self.mode = '' # a mode string for the status bar
self.set_history_buttons()
def set_message(self, s):
'display a message on toolbar or in status bar'
pass
def back(self, *args):
'move back up the view lim stack'
self._views.back()
self._positions.back()
self.set_history_buttons()
self._update_view()
def dynamic_update(self):
pass
def draw_rubberband(self, event, x0, y0, x1, y1):
'draw a rectangle rubberband to indicate zoom limits'
pass
def forward(self, *args):
'move forward in the view lim stack'
self._views.forward()
self._positions.forward()
self.set_history_buttons()
self._update_view()
def home(self, *args):
'restore the original view'
self._views.home()
self._positions.home()
self.set_history_buttons()
self._update_view()
def _init_toolbar(self):
"""
This is where you actually build the GUI widgets (called by
__init__). The icons home.xpm, back.xpm, forward.xpm,
hand.xpm, zoom_to_rect.xpm and filesave.xpm are standard
across backends (there are ppm versions in CVS also).
You just need to set the callbacks
home : self.home
back : self.back
forward : self.forward
hand : self.pan
#.........这里部分代码省略.........