本文整理汇总了Python中matplotlib.backend_bases.FigureCanvasBase.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasBase.__init__方法的具体用法?Python FigureCanvasBase.__init__怎么用?Python FigureCanvasBase.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backend_bases.FigureCanvasBase
的用法示例。
在下文中一共展示了FigureCanvasBase.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from matplotlib.backend_bases import FigureCanvasBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureCanvasBase import __init__ [as 别名]
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)
示例2: __init__
# 需要导入模块: from matplotlib.backend_bases import FigureCanvasBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureCanvasBase import __init__ [as 别名]
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()
示例3: __init__
# 需要导入模块: from matplotlib.backend_bases import FigureCanvasBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureCanvasBase import __init__ [as 别名]
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)
示例4: __init__
# 需要导入模块: from matplotlib.backend_bases import FigureCanvasBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureCanvasBase import __init__ [as 别名]
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)
示例5: __init__
# 需要导入模块: from matplotlib.backend_bases import FigureCanvasBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureCanvasBase import __init__ [as 别名]
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())
示例6: __init__
# 需要导入模块: from matplotlib.backend_bases import FigureCanvasBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureCanvasBase import __init__ [as 别名]
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
示例7: __init__
# 需要导入模块: from matplotlib.backend_bases import FigureCanvasBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureCanvasBase import __init__ [as 别名]
def __init__(self, figure):
FigureCanvasBase.__init__(self, figure)
if self.__class__ == matplotlib.backends.backend_gdk.FigureCanvasGDK:
warn_deprecated('2.0', message="The GDK backend is "
"deprecated. It is untested, known to be "
"broken and will be removed in Matplotlib 2.2. "
"Use the Agg backend instead. "
"See Matplotlib usage FAQ for"
" more info on backends.",
alternative="Agg")
self._renderer_init()
示例8: __init__
# 需要导入模块: from matplotlib.backend_bases import FigureCanvasBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureCanvasBase import __init__ [as 别名]
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 )
# hide until we can test and fix
#self.startTimer(backend_IdleEvent.milliseconds)
w,h = self.get_width_height()
self.resize( w, h )
示例9: __init__
# 需要导入模块: from matplotlib.backend_bases import FigureCanvasBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureCanvasBase import __init__ [as 别名]
def __init__(self, figure):
if DEBUG:
print('FigureCanvasQt qt4: ', figure)
_create_qApp()
# Note different super-calling style to backend_qt5
QtWidgets.QWidget.__init__(self)
FigureCanvasBase.__init__(self, figure)
self.figure = figure
self.setMouseTracking(True)
self._idle = True
w, h = self.get_width_height()
self.resize(w, h)
示例10: __init__
# 需要导入模块: from matplotlib.backend_bases import FigureCanvasBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureCanvasBase import __init__ [as 别名]
def __init__( self, figure ):
if DEBUG: print 'FigureCanvasQt: ', figure
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 )
QtCore.QObject.connect(self, QtCore.SIGNAL('destroyed()'),
self.close_event)
示例11: __init__
# 需要导入模块: from matplotlib.backend_bases import FigureCanvasBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureCanvasBase import __init__ [as 别名]
def __init__(self, figure):
if DEBUG:
print('FigureCanvasQt: ', figure)
_create_qApp()
if QT5:
# PyQt5 wants figure= ... why? :)
QtGui.QWidget.__init__(self, figure=figure)
else:
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)
示例12: __init__
# 需要导入模块: from matplotlib.backend_bases import FigureCanvasBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureCanvasBase import __init__ [as 别名]
def __init__(self, figure):
if self.__class__ == matplotlib.backends.backend_gtk.FigureCanvasGTK:
warn_deprecated(
"2.0",
message="The GTK backend is "
"deprecated. It is untested, known to be "
"broken and will be removed in Matplotlib 2.2. "
"Use the GTKAgg backend instead. "
"See Matplotlib usage FAQ for"
" more info on backends.",
alternative="GTKAgg",
)
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.last_downclick = {}
示例13: initWithFrame_figure_
# 需要导入模块: from matplotlib.backend_bases import FigureCanvasBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureCanvasBase import __init__ [as 别名]
def initWithFrame_figure_(self, frame, fig):
"""
Designated initializer.
* Parameters *
frame : NSRect
fig : matplotlib.figure.Figure
"""
self = super(FigureCanvasView, self).initWithFrame_(frame)
if self != None:
FigureCanvasBase.__init__(self, fig)
self.renderer = RendererCocoa(self)
self.manager = None
# several methods can change the frame,
# so we'll just observe the common notification
nc = NSNotificationCenter.defaultCenter()
nc.addObserver_selector_name_object_(self, "frameChanged:", NSViewFrameDidChangeNotification, self)
self.updateFigureSize()
return self
示例14: __init__
# 需要导入模块: from matplotlib.backend_bases import FigureCanvasBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureCanvasBase import __init__ [as 别名]
def __init__(self, figure):
FigureCanvasBase.__init__(self, figure)
width, height = self.get_width_height()
self.renderer = RendererMac(figure.dpi, width, height)
_macosx.FigureCanvas.__init__(self, width, height)
示例15: __init__
# 需要导入模块: from matplotlib.backend_bases import FigureCanvasBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureCanvasBase import __init__ [as 别名]
def __init__(self, figure):
FigureCanvasBase.__init__(self, figure)
self._renderer_init()