本文整理汇总了Python中matplotlib.backend_bases.key_press_handler函数的典型用法代码示例。如果您正苦于以下问题:Python key_press_handler函数的具体用法?Python key_press_handler怎么用?Python key_press_handler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了key_press_handler函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_key_event
def on_key_event(self, event):
if event.key == 'a':
ax = event.inaxes
ax.set_autoscalex_on(True)
ax.set_autoscaley_on(True)
else:
key_press_handler(event, self.canvas, self.toolbar)
示例2: on_key_press
def on_key_press(self, event):
#绑定键盘事件到画布和工具栏
key_press_handler(event, self.canvas, self.toolbar)
if event.key == "enter":
self.data.get_homo()
elif event.key == "N":
self.emit(QtCore.SIGNAL("play_next()"))
示例3: on_key_event
def on_key_event(self, event):
print('you pressed %s'%event.key)
key_press_handler(event, self.canvas, self.toolbar)
if event.key in ['q','escape']: # Use (some) unassigned buttons to quit
print('--> Program quit')
self.root.quit()
self.root.destroy() # this is necessary on Windows to prevent
示例4: on_key_press
def on_key_press(self, event):
from matplotlib.backend_bases import key_press_handler
print("you pressed", event.key)
# implement the default mpl key press events described at
# http://matplotlib.org/users/navigation_toolbar.html
key_press_handler(event, self.canvas, self.mpl_toolbar)
示例5: on_key_event
def on_key_event(self, event):
"""
@param event:
@return
"""
print('you pressed %s' % event.key)
key_press_handler(event, self.canvas, self.toolbar)
示例6: on_key_press
def on_key_press(self, event):
print('Plot pressed', event.key)
# implement the default mpl key press events described at
# http://matplotlib.org/users/navigation_toolbar.html#navigation-keyboard-shortcuts
try:
key_press_handler(event, self.canvas, self.mpl_toolbar)
except:
pass
示例7: on_key_press
def on_key_press(self, event):
# sometimes mpl has a weird ideas what oo-programing is.
# any could overwrite method by my self
# no fullscreen unless self is a window!
if event.key == "t":
self.toolbar.toggle()
elif event.key not in rcParams["keymap.fullscreen"]:
key_press_handler(event, self.canvas, self.toolbar)
示例8: on_key_press
def on_key_press(self, event):
if event.key == 'a' or event.key == "alt+a" and event.inaxes:
ax = event.inaxes
ax.relim()
l = 1.1*max(abs(ax.dataLim.y0), abs(ax.dataLim.y1))
ax.set_ylim(-l,l)
ax.figure.canvas.draw()
else:
key_press_handler(event, event.canvas, self.toolbar)
示例9: on_key_press
def on_key_press(self, event):
# print 'Matplotlib-> you pressed:' + str(event.key)
# implement the default mpl key press events described at
# http://matplotlib.org/users/navigation_toolbar.html#navigation-
# keyboard-shortcuts
try:
from matplotlib.backend_bases import key_press_handler
key_press_handler(event, self.canvas, self.mpl_toolbar)
except:
print("key_press_handler import failed. -old matplotlib version.")
示例10: on_key_press
def on_key_press(self, event):
key_press_handler(event, self.canvas, self.mpl_toolbar)
if event.key == 'a':
command = commands.AddIonsToTable([self._picked_ion], self._analyses_model)
self._undo_stack.push(command)
if event.key == 'r':
command = commands.AddIonsToTable([self._picked_ion], self._analyses_model)
self._undo_stack.push(command)
command = commands.SelectMethod(self._picked_ion, 'Manual', self._analyses_model, self._methods_view_model)
self._undo_stack.push(command)
self._span_selector = SpanSelector(self.ax,self.on_span_select,'horizontal', minspan=0.0001, span_stays=True, rectprops=dict(alpha=0.5))
QApplication.setOverrideCursor(QCursor(Qt.IBeamCursor))
示例11: canvas_key_press
def canvas_key_press(self, event):
key_press_handler(event, self.canvas, self.mpl_toolbar)
if event.key == 'ctrl+q':
self._close()
elif event.key in mpl.rcParams['keymap.home']:
self.xlim = self.ylim = None
self.draw()
elif event.key == 'ctrl+x':
self.set_xlim(draw=False)
elif event.key == 'ctrl+y':
self.set_ylim(draw=False)
elif event.key == 'ctrl+l':
self.draw()
self.xlogscale = self.axes.get_xscale()
self.ylogscale = self.axes.get_yscale()
示例12: on_key_event
def on_key_event(event):
#Flecha de abajo
if event.key==D:
global state
global a
global b
global x
x = x
if state==5:
state=0
else:
state=state+1
graficar(x)
#Flecha de arriba
elif event.key==U:
global state
global a
global b
global x
x = x
if state==0:
state=5
else:
state=state-1
graficar(x)
#Flecha derecha
elif event.key==R:
global a
global b
global x
if x>=700:
x=700
else:
x = x + 10
graficar(x)
#Flecha Izquierda
elif event.key==L:
global a
global b
global x
if x<=200:
x=200
else:
x = x - 10
graficar(x)
else:
pass
key_press_handler(event, canvas, toolbar)
示例13: keyPressEvent
def keyPressEvent(self, event):
""" Catch key events so that they can be passed on to the matplotlib
toolbar. """
try:
key_press_handler(event, self.canvas, self.toolbar)
except AttributeError:
# Attribute errors seem to occur when a key is pressed while the
# mouse is outside of the figure area:
#
# AttributeError: 'QKeyEvent' object has no attribute 'inaxes'
#
# This exception may be safely ignored.
pass
except Exception as e:
print(e)
raise e
示例14: tracer_key_handler
def tracer_key_handler( self, event ) :
if event.key == 'p' or event.key == ' ' :
self.pause()
elif event.key == 'b' :
self.band()
elif event.key == 'd' :
self.save_data()
elif event.key == 'a' :
event.inaxes.abscissa.set_visible( not event.inaxes.abscissa.get_visible() )
self.canvas.draw()
else :
try :
key_press_handler( event, self.canvas, self )
except NameError :
pass
示例15: on_key
def on_key(self,event):
"""to change scale from linear to logaritm
Home/Reset h or r or home
Back c or left arrow or backspace
Forward v or right arrow
Pan/Zoom p
Zoom-to-rect o
Save ctrl + s
Toggle fullscreen ctrl + f
Close plot ctrl + w
Constrain pan/zoom to x axis hold x when panning/zooming with mouse
Constrain pan/zoom to y axis hold y when panning/zooming with mouse
Preserve aspect ratio hold CONTROL when panning/zooming with mouse
Toggle grid g when mouse is over an axes
Toggle x axis scale (log/linear) L or k when mouse is over an axes
Toggle y axis scale (log/linear) l when mouse is over an axes
"""
key_press_handler(event, self.canvas, self.toolbar)