本文整理汇总了Python中matplotlib.backend_bases.FigureCanvasBase类的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasBase类的具体用法?Python FigureCanvasBase怎么用?Python FigureCanvasBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FigureCanvasBase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__( self, figure ):
if DEBUG: print('FigureCanvasQt: ', figure)
_create_qApp()
QtGui.QWidget.__init__( self )
FigureCanvasBase.__init__( self, figure )
self.figure = figure
self.setMouseTracking( True )
self._idle = True
# hide until we can test and fix
#self.startTimer(backend_IdleEvent.milliseconds)
w,h = self.get_width_height()
self.resize( w, h )
# JDH: Note the commented out code below does not work as
# expected, because according to Pierre Raybaut, The reason is
# that PyQt fails (silently) to call a method of this object
# just before detroying it. Using a lambda function will work,
# exactly the same as using a function (which is not bound to
# the object to be destroyed).
#
#QtCore.QObject.connect(self, QtCore.SIGNAL('destroyed()'),
# self.close_event)
QtCore.QObject.connect(self, QtCore.SIGNAL('destroyed()'),
lambda: self.close_event())
开发者ID:chrishowes,项目名称:matplotlib,代码行数:25,代码来源:backend_qt4.py
示例2: resize
def resize(self, width, height):
self.renderer.set_width_height(width, height)
dpi = self.figure.dpi
width /= dpi
height /= dpi
self.figure.set_size_inches(width, height)
FigureCanvasBase.resize_event(self)
开发者ID:ethanhelfman,项目名称:InstaGet,代码行数:7,代码来源:backend_macosx.py
示例3: mouseMoveEvent
def mouseMoveEvent(self, event):
x = event.x()
# flipy so y=0 is bottom of canvas
y = self.figure.bbox.height - event.y()
FigureCanvasBase.motion_notify_event(self, x, y)
if DEBUG:
print("mouse move")
开发者ID:huard,项目名称:matplotlib,代码行数:7,代码来源:backend_qt.py
示例4: __init__
def __init__(self, figure):
FigureCanvasBase.__init__(self, figure)
# print "Init of Canvas called....",figure
self.frame_count = 0
global figure_number
self.figure_number = figure_number
figure_number += 1
self._clients = set()
self._frame = None
self._header = ""
self._home_x = {}
self._home_y = {}
self._zoomed = False
self._first_frame = True
self._width, self._height = self.get_width_height()
self.flip = Affine2D().scale(1, -1).translate(0, self._height)
# Start WebSocket server
try:
self._server = websocket.WebSocketApp(
"ws://" + HOST + ":" + PORT + "/client/" + SESSION_ID,
on_open=self.web_socket_open,
on_message=self.web_socket_message,
on_close=self.web_socket_close,
on_error=self.web_socket_close,
)
self._thread = thread.start_new_thread(self._server.run_forever, ())
except Exception, e:
print "Failed to create websocket server. (%s)" % str(e)
# sys.exit(1)
raise e
开发者ID:brefsdal,项目名称:peerplot,代码行数:31,代码来源:backend_h5canvas.py
示例5: button_press_event
def button_press_event(self, widget, event):
if _debug: print 'FigureCanvasGTK.{0!s}'.format(fn_name())
x = event.x
# flipy so y=0 is bottom of canvas
y = self.allocation.height - event.y
FigureCanvasBase.button_press_event(self, x, y, event.button)
return False # finish event propagation?
开发者ID:runt18,项目名称:nupic,代码行数:7,代码来源:backend_gtk.py
示例6: mousePressEvent
def mousePressEvent( self, event ):
x = event.pos().x()
# flipy so y=0 is bottom of canvas
y = self.figure.bbox.height - event.pos().y()
button = self.buttond[event.button()]
FigureCanvasBase.button_press_event( self, x, y, button )
if DEBUG: print 'button pressed:', event.button()
开发者ID:qsnake,项目名称:matplotlib,代码行数:7,代码来源:backend_qt4.py
示例7: button_release_event
def button_release_event(self, widget, event):
x = event.x
# flipy so y=0 is bottom of canvas
y = self.get_allocation().height - event.y
FigureCanvasBase.button_release_event(
self, x, y, event.button, guiEvent=event)
return False # finish event propagation?
开发者ID:QuLogic,项目名称:matplotlib,代码行数:7,代码来源:backend_gtk3.py
示例8: __init__
def __init__(self, figure):
FigureCanvasBase.__init__(self, figure)
GObject.GObject.__init__(self)
self._idle_draw_id = 0
self._lastCursor = None
self.connect('scroll_event', self.scroll_event)
self.connect('button_press_event', self.button_press_event)
self.connect('button_release_event', self.button_release_event)
self.connect('configure_event', self.configure_event)
self.connect('draw', self.on_draw_event)
self.connect('key_press_event', self.key_press_event)
self.connect('key_release_event', self.key_release_event)
self.connect('motion_notify_event', self.motion_notify_event)
self.connect('leave_notify_event', self.leave_notify_event)
self.connect('enter_notify_event', self.enter_notify_event)
self.connect('size_allocate', self.size_allocate)
self.set_events(self.__class__.event_mask)
self.set_double_buffered(True)
self.set_can_focus(True)
self._renderer_init()
default_context = GLib.main_context_get_thread_default() or GLib.main_context_default()
开发者ID:Carreau,项目名称:matplotlib,代码行数:25,代码来源:backend_gtk3.py
示例9: __init__
def __init__(self, figure):
if _debug: print('FigureCanvasGTK3.%s' % fn_name())
FigureCanvasBase.__init__(self, figure)
GObject.GObject.__init__(self)
self._idle_draw_id = 0
self._need_redraw = True
self._lastCursor = None
self.connect('scroll_event', self.scroll_event)
self.connect('button_press_event', self.button_press_event)
self.connect('button_release_event', self.button_release_event)
self.connect('configure_event', self.configure_event)
self.connect('draw', self.on_draw_event)
self.connect('key_press_event', self.key_press_event)
self.connect('key_release_event', self.key_release_event)
self.connect('motion_notify_event', self.motion_notify_event)
self.connect('leave_notify_event', self.leave_notify_event)
self.connect('enter_notify_event', self.enter_notify_event)
self.connect('size_allocate', self.size_allocate)
self.set_events(self.__class__.event_mask)
self.set_double_buffered(True)
self.set_can_focus(True)
self._renderer_init()
self._idle_event_id = GLib.idle_add(self.idle_event)
default_context = GLib.main_context_get_thread_default() or GLib.main_context_default()
self._idle_event_source = default_context.find_source_by_id(self._idle_event_id)
开发者ID:7924102,项目名称:matplotlib,代码行数:29,代码来源:backend_gtk3.py
示例10: mouseReleaseEvent
def mouseReleaseEvent( self, event ):
x = event.x()
# flipy so y=0 is bottom of canvas
y = self.figure.bbox.height - event.y()
button = self.buttond[event.button()]
FigureCanvasBase.button_release_event( self, x, y, button )
if DEBUG: print 'button released'
开发者ID:qsnake,项目名称:matplotlib,代码行数:7,代码来源:backend_qt4.py
示例11: mouseDoubleClickEvent
def mouseDoubleClickEvent( self, event ):
x = event.pos().x()
# flipy so y=0 is bottom of canvas
y = self.figure.bbox.height - event.pos().y()
button = self.buttond[event.button()]
FigureCanvasBase.button_press_event( self, x, y, button, dblclick=True )
if DEBUG: print('button doubleclicked:', event.button())
开发者ID:BlackEarth,项目名称:portable-python-win32,代码行数:7,代码来源:backend_qt.py
示例12: size_allocate
def size_allocate(self, widget, allocation):
dpival = self.figure.dpi
winch = allocation.width / dpival
hinch = allocation.height / dpival
self.figure.set_size_inches(winch, hinch, forward=False)
FigureCanvasBase.resize_event(self)
self.draw_idle()
开发者ID:jklymak,项目名称:matplotlib,代码行数:7,代码来源:backend_gtk3.py
示例13: scroll_event
def scroll_event(self, widget, event):
x = event.x
# flipy so y=0 is bottom of canvas
y = self.get_allocation().height - event.y
step = 1 if event.direction == Gdk.ScrollDirection.UP else -1
FigureCanvasBase.scroll_event(self, x, y, step, guiEvent=event)
return False # finish event propagation?
开发者ID:QuLogic,项目名称:matplotlib,代码行数:7,代码来源:backend_gtk3.py
示例14: __init__
def __init__(self, figure):
if _debug: print 'FigureCanvasGTK.%s' % fn_name()
FigureCanvasBase.__init__(self, figure)
gtk.DrawingArea.__init__(self)
self._idle_draw_id = 0
self._need_redraw = True
self._pixmap_width = -1
self._pixmap_height = -1
self._lastCursor = None
self.connect('scroll_event', self.scroll_event)
self.connect('button_press_event', self.button_press_event)
self.connect('button_release_event', self.button_release_event)
self.connect('configure_event', self.configure_event)
self.connect('expose_event', self.expose_event)
self.connect('key_press_event', self.key_press_event)
self.connect('key_release_event', self.key_release_event)
self.connect('motion_notify_event', self.motion_notify_event)
self.connect('leave_notify_event', self.leave_notify_event)
self.connect('enter_notify_event', self.enter_notify_event)
self.set_events(self.__class__.event_mask)
self.set_double_buffered(False)
self.set_flags(gtk.CAN_FOCUS)
self._renderer_init()
self._idle_event_id = gobject.idle_add(self.idle_event)
开发者ID:AndreI11,项目名称:SatStressGui,代码行数:29,代码来源:backend_gtk.py
示例15: button_release_event
def button_release_event(self, widget, event):
if _debug: print 'FigureCanvasGTK.%s' % fn_name()
x = event.x
# flipy so y=0 is bottom of canvas
y = self.allocation.height - event.y
FigureCanvasBase.button_release_event(self, x, y, event.button, guiEvent=event)
return False # finish event propagation?
开发者ID:AndreI11,项目名称:SatStressGui,代码行数:7,代码来源:backend_gtk.py
示例16: mouseDoubleClickEvent
def mouseDoubleClickEvent(self, event):
x, y = self.mouseEventCoords(event.pos())
button = self.buttond.get(event.button())
if button is not None:
FigureCanvasBase.button_press_event(self, x, y,
button, dblclick=True,
guiEvent=event)
开发者ID:endolith,项目名称:matplotlib,代码行数:7,代码来源:backend_qt5.py
示例17: enterEvent
def enterEvent(self, event):
try:
x, y = self.mouseEventCoords(event.pos())
except AttributeError:
# the event from PyQt4 does not include the position
x = y = None
FigureCanvasBase.enter_notify_event(self, guiEvent=event, xy=(x, y))
开发者ID:endolith,项目名称:matplotlib,代码行数:7,代码来源:backend_qt5.py
示例18: __init__
def __init__(self, figure):
if _debug: print 'FigureCanvasGTK3.%s' % fn_name()
FigureCanvasBase.__init__(self, figure)
GObject.GObject.__init__(self)
self._idle_draw_id = 0
self._need_redraw = True
self._lastCursor = None
self.connect('scroll_event', self.scroll_event)
self.connect('button_press_event', self.button_press_event)
self.connect('button_release_event', self.button_release_event)
self.connect('configure_event', self.configure_event)
self.connect('draw', self.on_draw_event)
self.connect('key_press_event', self.key_press_event)
self.connect('key_release_event', self.key_release_event)
self.connect('motion_notify_event', self.motion_notify_event)
self.connect('leave_notify_event', self.leave_notify_event)
self.connect('enter_notify_event', self.enter_notify_event)
self.set_events(self.__class__.event_mask)
self.set_double_buffered(True)
self.set_can_focus(True)
self._renderer_init()
self._idle_event_id = GObject.idle_add(self.idle_event)
开发者ID:JackKelly,项目名称:matplotlib,代码行数:26,代码来源:backend_gtk3.py
示例19: keyReleaseEvent
def keyReleaseEvent(self, event):
key = self._get_key(event)
if key is None:
return
FigureCanvasBase.key_release_event(self, key, guiEvent=event)
if DEBUG:
print('key release', key)
开发者ID:Acanthostega,项目名称:matplotlib,代码行数:7,代码来源:backend_qt5.py
示例20: keyPressEvent
def keyPressEvent(self, event):
key = self._get_key(event)
if key is None:
return
FigureCanvasBase.key_press_event(self, key, guiEvent=event)
if DEBUG:
print('key press', key)
开发者ID:Acanthostega,项目名称:matplotlib,代码行数:7,代码来源:backend_qt5.py
注:本文中的matplotlib.backend_bases.FigureCanvasBase类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论