当前位置: 首页>>代码示例>>Python>>正文


Python FigureManagerBase.__init__方法代码示例

本文整理汇总了Python中matplotlib.backend_bases.FigureManagerBase.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python FigureManagerBase.__init__方法的具体用法?Python FigureManagerBase.__init__怎么用?Python FigureManagerBase.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.backend_bases.FigureManagerBase的用法示例。


在下文中一共展示了FigureManagerBase.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from matplotlib.backend_bases import FigureManagerBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureManagerBase import __init__ [as 别名]
    def __init__(self, canvas, num):
        FigureManagerBase.__init__(self, canvas, num)
        self.canvas = canvas

        window = MatPlotWindow(mainWin.workSpace)
        window.setup(canvas, num)
        self.window = window


        QtCore.QObject.connect(window, QtCore.SIGNAL('destroyed()'),
                            self._widgetclosed)
        window._destroying = False

        toolbar = self._get_toolbar(canvas, window)
        window.toolbar = toolbar
        self.toolbar = toolbar
        if toolbar:
           window.mainLayout.addWidget(toolbar, 0)

        window.resize(640, 480)

        if matplotlib.is_interactive():
            window.setMinimumSize(200, 200)
            window.show()

        def notify_axes_change(fig):
           # This will be called whenever the current axes is changed
           if self.toolbar != None: self.toolbar.update()
           self.canvas.figure.add_axobserver(notify_axes_change)
开发者ID:BackupTheBerlios,项目名称:simuvis4-svn,代码行数:31,代码来源:backend_sv4agg.py

示例2: __init__

# 需要导入模块: from matplotlib.backend_bases import FigureManagerBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureManagerBase import __init__ [as 别名]
    def __init__(self, canvas, num, window):
        FigureManagerBase.__init__(self, canvas, num)
        self.window = window
        self.window.withdraw()
        self.set_window_title("Figure %d" % num)
        self.canvas = canvas
        self.canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
        self._num = num

        self.toolmanager = self._get_toolmanager()
        self.toolbar = self._get_toolbar()
        self.statusbar = None

        if self.toolmanager:
            backend_tools.add_tools_to_manager(self.toolmanager)
            if self.toolbar:
                backend_tools.add_tools_to_container(self.toolbar)
                self.statusbar = StatusbarTk(self.window, self.toolmanager)

        self._shown = False

        def notify_axes_change(fig):
            'this will be called whenever the current axes is changed'
            if self.toolmanager is not None:
                pass
            elif self.toolbar is not None:
                self.toolbar.update()
        self.canvas.figure.add_axobserver(notify_axes_change)
开发者ID:kshramt,项目名称:matplotlib,代码行数:30,代码来源:backend_tkagg.py

示例3: __init__

# 需要导入模块: from matplotlib.backend_bases import FigureManagerBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureManagerBase import __init__ [as 别名]
    def __init__(self, canvas, num):
        if DEBUG: print 'FigureManagerGTK.%s' % fn_name()
        FigureManagerBase.__init__(self, canvas, num)
        
        self.window = gtk.Window()
        self.window.set_title("Figure %d" % num)

        vbox = gtk.VBox()
        self.window.add(vbox)
        vbox.show()

        self.canvas.show()
        vbox.pack_start(self.canvas, True, True)

        # must be inited after the window, drawingArea and figure
        # attrs are set
        if matplotlib.rcParams['toolbar']=='classic':
            self.toolbar = NavigationToolbar (canvas, self.window)
        elif matplotlib.rcParams['toolbar']=='toolbar2':
            self.toolbar = NavigationToolbar2GTK (canvas, self.window)
        else:
            self.toolbar = None

        if self.toolbar != None:
            self.toolbar.show()
            vbox.pack_end(self.toolbar, False, False)

        def destroy(*args): Gcf.destroy(num)
        self.window.connect("destroy", destroy)
        self.window.connect("delete_event", destroy)        
        if matplotlib.is_interactive():
            self.window.show()
开发者ID:,项目名称:,代码行数:34,代码来源:

示例4: __init__

# 需要导入模块: from matplotlib.backend_bases import FigureManagerBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureManagerBase import __init__ [as 别名]
    def __init__(self, canvas, num, window):
        FigureManagerBase.__init__(self, canvas, num)
        self.window = window
        self.window.withdraw()
        self.set_window_title("Figure %d" % num)
        self.canvas = canvas
        # If using toolmanager it has to be present when initializing the toolbar
        self.toolmanager = self._get_toolmanager()
        # packing toolbar first, because if space is getting low, last packed widget is getting shrunk first (-> the canvas)
        self.toolbar = self._get_toolbar()
        self.canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
        self._num = num

        self.statusbar = None

        if self.toolmanager:
            backend_tools.add_tools_to_manager(self.toolmanager)
            if self.toolbar:
                backend_tools.add_tools_to_container(self.toolbar)
                self.statusbar = StatusbarTk(self.window, self.toolmanager)

        self._shown = False

        def notify_axes_change(fig):
            'this will be called whenever the current axes is changed'
            if self.toolmanager is not None:
                pass
            elif self.toolbar is not None:
                self.toolbar.update()
        self.canvas.figure.add_axobserver(notify_axes_change)
开发者ID:dpritsos,项目名称:TeCA,代码行数:32,代码来源:_backend_tk.py

示例5: initWithFigure_number_

# 需要导入模块: from matplotlib.backend_bases import FigureManagerBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureManagerBase import __init__ [as 别名]
    def initWithFigure_number_(self, fig, num):
        """__init__"""

        win = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_(
            NSMakeRect(100, 100, 640, 480),
            NSBorderlessWindowMask
            | NSTitledWindowMask
            | NSClosableWindowMask
            | NSMiniaturizableWindowMask
            | NSResizableWindowMask,
            NSBackingStoreBuffered,
            True,
        )
        self = super(FigureManagerCocoa, self).initWithWindow_(win)
        if self != None:
            cViewBounds = self.window().contentView().bounds()
            plotViewFrame = NSMakeRect(0, 0, cViewBounds.size.width, cViewBounds.size.height)
            plotView = FigureCanvasView.alloc().initWithFrame_figure_(plotViewFrame, fig)
            plotView.setAutoresizingMask_(NSViewWidthSizable | NSViewHeightSizable)

            FigureManagerBase.__init__(self, plotView, num)

            self.window().contentView().addSubview_(plotView)
            self.window().setTitle_("Figure %d" % num)

            self.show_window()
        return self
开发者ID:zoccolan,项目名称:eyetracker,代码行数:29,代码来源:cocoa_backend.py

示例6: __init__

# 需要导入模块: from matplotlib.backend_bases import FigureManagerBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureManagerBase import __init__ [as 别名]
 def __init__(self, canvas, num):
     FigureManagerBase.__init__(self, canvas, num)
     global index
     index += 1
     self.canvas = canvas
     self._num = num
     self._shown = False
开发者ID:yuchuangu85,项目名称:intellij-community,代码行数:9,代码来源:backend_interagg.py

示例7: __init__

# 需要导入模块: from matplotlib.backend_bases import FigureManagerBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureManagerBase import __init__ [as 别名]
    def __init__(self, canvas, num, window):
        FigureManagerBase.__init__(self, canvas, num)
        self.window = window
        self.window.withdraw()
        self.window.wm_title("Figure %d" % num)
        self.canvas = canvas
        self._num =  num
        t1,t2,w,h = canvas.figure.bbox.bounds
        w, h = int(w), int(h)
        self.window.minsize(int(w*3/4),int(h*3/4))
        if matplotlib.rcParams['toolbar']=='classic':
            self.toolbar = NavigationToolbar( canvas, self.window )
        elif matplotlib.rcParams['toolbar']=='toolbar2':
            self.toolbar = NavigationToolbar2TkAgg( canvas, self.window )
        else:
            self.toolbar = None
        if self.toolbar is not None:
            self.toolbar.update()
        self.canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
        self._shown = False

        def notify_axes_change(fig):
            'this will be called whenever the current axes is changed'
            if self.toolbar != None: self.toolbar.update()
        self.canvas.figure.add_axobserver(notify_axes_change)



        # attach a show method to the figure for pylab ease of use
        self.canvas.figure.show = lambda *args: self.show()
开发者ID:astraw,项目名称:matplotlib,代码行数:32,代码来源:backend_tkagg.py

示例8: __init__

# 需要导入模块: from matplotlib.backend_bases import FigureManagerBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureManagerBase import __init__ [as 别名]
    def __init__(self, canvas, num):
        FigureManagerBase.__init__(self, canvas, num)

        self.window = Gtk.Window()
        self.window.set_wmclass("matplotlib", "Matplotlib")
        self.set_window_title("Figure %d" % num)
        try:
            self.window.set_icon_from_file(window_icon)
        except Exception:
            # Some versions of gtk throw a glib.GError but not all, so I am not
            # sure how to catch it.  I am unhappy doing a blanket catch here,
            # but am not sure what a better way is - JDH
            _log.info('Could not load matplotlib icon: %s', sys.exc_info()[1])

        self.vbox = Gtk.Box()
        self.vbox.set_property("orientation", Gtk.Orientation.VERTICAL)
        self.window.add(self.vbox)
        self.vbox.show()

        self.canvas.show()

        self.vbox.pack_start(self.canvas, True, True, 0)
        # calculate size for window
        w = int(self.canvas.figure.bbox.width)
        h = int(self.canvas.figure.bbox.height)

        self.toolmanager = self._get_toolmanager()
        self.toolbar = self._get_toolbar()
        self.statusbar = None

        def add_widget(child, expand, fill, padding):
            child.show()
            self.vbox.pack_end(child, False, False, 0)
            size_request = child.size_request()
            return size_request.height

        if self.toolmanager:
            backend_tools.add_tools_to_manager(self.toolmanager)
            if self.toolbar:
                backend_tools.add_tools_to_container(self.toolbar)
                self.statusbar = StatusbarGTK3(self.toolmanager)
                h += add_widget(self.statusbar, False, False, 0)
                h += add_widget(Gtk.HSeparator(), False, False, 0)

        if self.toolbar is not None:
            self.toolbar.show()
            h += add_widget(self.toolbar, False, False, 0)

        self.window.set_default_size(w, h)

        def destroy(*args):
            Gcf.destroy(num)
        self.window.connect("destroy", destroy)
        self.window.connect("delete_event", destroy)
        if matplotlib.is_interactive():
            self.window.show()
            self.canvas.draw_idle()

        self.canvas.grab_focus()
开发者ID:jklymak,项目名称:matplotlib,代码行数:61,代码来源:backend_gtk3.py

示例9: __init__

# 需要导入模块: from matplotlib.backend_bases import FigureManagerBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureManagerBase import __init__ [as 别名]
    def __init__(self, canvas, num):
        FigureManagerBase.__init__(self, canvas, num)

        try:
            WMEnable('Matplotlib')
        except:
            # MULTIPLE FIGURES ARE BUGGY!
            pass # If there are multiple figures we only need to enable once
开发者ID:CTPUG,项目名称:matplotlib-py3,代码行数:10,代码来源:backend_cocoaagg.py

示例10: __init__

# 需要导入模块: from matplotlib.backend_bases import FigureManagerBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureManagerBase import __init__ [as 别名]
    def __init__(self, canvas, num):
        if DEBUG:
            print("FigureManagerQT.%s" % fn_name())
        FigureManagerBase.__init__(self, canvas, num)
        self.canvas = canvas
        self.window = MainWindow()
        self.window.closing.connect(canvas.close_event)
        self.window.closing.connect(self._widgetclosed)

        self.window.setWindowTitle("Figure %d" % num)
        image = os.path.join(matplotlib.rcParams["datapath"], "images", "matplotlib.png")
        self.window.setWindowIcon(QtGui.QIcon(image))

        # Give the keyboard focus to the figure instead of the
        # manager; StrongFocus accepts both tab and click to focus and
        # will enable the canvas to process event w/o clicking.
        # ClickFocus only takes the focus is the window has been
        # clicked
        # on. http://qt-project.org/doc/qt-4.8/qt.html#FocusPolicy-enum or
        # http://doc.qt.digia.com/qt/qt.html#FocusPolicy-enum
        self.canvas.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.canvas.setFocus()

        self.window._destroying = False

        self.toolbar = self._get_toolbar(self.canvas, self.window)
        if self.toolbar is not None:
            self.window.addToolBar(self.toolbar)
            self.toolbar.message.connect(self._show_message)
            tbs_height = self.toolbar.sizeHint().height()
        else:
            tbs_height = 0

        # add text label to status bar
        self.statusbar_label = QtWidgets.QLabel()
        self.window.statusBar().addWidget(self.statusbar_label)

        # resize the main window so it will display the canvas with the
        # requested size:
        cs = canvas.sizeHint()
        sbs = self.window.statusBar().sizeHint()
        self._status_and_tool_height = tbs_height + sbs.height()
        height = cs.height() + self._status_and_tool_height
        self.window.resize(cs.width(), height)

        self.window.setCentralWidget(self.canvas)

        if matplotlib.is_interactive():
            self.window.show()
            self.canvas.draw_idle()

        def notify_axes_change(fig):
            # This will be called whenever the current axes is changed
            if self.toolbar is not None:
                self.toolbar.update()

        self.canvas.figure.add_axobserver(notify_axes_change)
        self.window.raise_()
开发者ID:zaherabdulazeez,项目名称:matplotlib,代码行数:60,代码来源:backend_qt5.py

示例11: __init__

# 需要导入模块: from matplotlib.backend_bases import FigureManagerBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureManagerBase import __init__ [as 别名]
    def __init__(self, canvas, num):
        if _debug:
            print("FigureManagerGTK.%s" % fn_name())
        FigureManagerBase.__init__(self, canvas, num)

        self.window = gtk.Window()
        self.window.set_title("Figure %d" % num)
        if window_icon:
            try:
                self.window.set_icon_from_file(window_icon)
            except:
                # some versions of gtk throw a glib.GError but not
                # all, so I am not sure how to catch it.  I am unhappy
                # diong a blanket catch here, but an not sure what a
                # better way is - JDH
                verbose.report("Could not load matplotlib icon: %s" % sys.exc_info()[1])

        self.vbox = gtk.VBox()
        self.window.add(self.vbox)
        self.vbox.show()

        self.canvas.show()

        # attach a show method to the figure  for pylab ease of use
        self.canvas.figure.show = lambda *args: self.window.show()

        self.vbox.pack_start(self.canvas, True, True)

        self.toolbar = self._get_toolbar(canvas)

        # calculate size for window
        w = int(self.canvas.figure.bbox.width)
        h = int(self.canvas.figure.bbox.height)

        if self.toolbar is not None:
            self.toolbar.show()
            self.vbox.pack_end(self.toolbar, False, False)

            tb_w, tb_h = self.toolbar.size_request()
            h += tb_h
        self.window.set_default_size(w, h)

        def destroy(*args):
            Gcf.destroy(num)

        self.window.connect("destroy", destroy)
        self.window.connect("delete_event", destroy)
        if matplotlib.is_interactive():
            self.window.show()

        def notify_axes_change(fig):
            "this will be called whenever the current axes is changed"
            if self.toolbar is not None:
                self.toolbar.update()

        self.canvas.figure.add_axobserver(notify_axes_change)

        self.canvas.grab_focus()
开发者ID:astraw,项目名称:matplotlib,代码行数:60,代码来源:backend_gtk.py

示例12: __init__

# 需要导入模块: from matplotlib.backend_bases import FigureManagerBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureManagerBase import __init__ [as 别名]
    def __init__(self, canvas, num):
        if _debug: print 'FigureManagerGTK3.%s' % fn_name()
        FigureManagerBase.__init__(self, canvas, num)

        self.window = Gtk.Window()
        self.set_window_title("Figure %d" % num)
        try:
            self.window.set_icon_from_file(window_icon)
        except (SystemExit, KeyboardInterrupt):
            # re-raise exit type Exceptions
            raise
        except:
            # some versions of gtk throw a glib.GError but not
            # all, so I am not sure how to catch it.  I am unhappy
            # doing a blanket catch here, but am not sure what a
            # better way is - JDH
            verbose.report('Could not load matplotlib icon: %s' % sys.exc_info()[1])

        self.vbox = Gtk.Box()
        self.vbox.set_property("orientation", Gtk.Orientation.VERTICAL)
        self.window.add(self.vbox)
        self.vbox.show()

        self.canvas.show()

        # attach a show method to the figure  for pylab ease of use
        self.canvas.figure.show = lambda *args: self.window.show()

        self.vbox.pack_start(self.canvas, True, True, 0)

        self.toolbar = self._get_toolbar(canvas)

        # calculate size for window
        w = int (self.canvas.figure.bbox.width)
        h = int (self.canvas.figure.bbox.height)

        if self.toolbar is not None:
            self.toolbar.show()
            self.vbox.pack_end(self.toolbar, False, False, 0)
            size_request = self.toolbar.size_request()
            h += size_request.height

        self.window.set_default_size (w, h)

        def destroy(*args):
            Gcf.destroy(num)
        self.window.connect("destroy", destroy)
        self.window.connect("delete_event", destroy)
        if matplotlib.is_interactive():
            self.window.show()

        def notify_axes_change(fig):
            'this will be called whenever the current axes is changed'
            if self.toolbar is not None: self.toolbar.update()
        self.canvas.figure.add_axobserver(notify_axes_change)

        self.canvas.grab_focus()
开发者ID:KennethNielsen,项目名称:matplotlib,代码行数:59,代码来源:backend_gtk3.py

示例13: __init__

# 需要导入模块: from matplotlib.backend_bases import FigureManagerBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureManagerBase import __init__ [as 别名]
    def __init__( self, canvas, num ):
        if DEBUG: print 'FigureManagerQT.%s' % fn_name()
        FigureManagerBase.__init__( self, canvas, num )
        self.canvas = canvas
        self.window = qt.QMainWindow( None, None, qt.Qt.WDestructiveClose )

        centralWidget = qt.QWidget( self.window )
        self.canvas.reparent( centralWidget, qt.QPoint( 0, 0 ) )
        
        # Give the keyboard focus to the figure instead of the manager
        self.canvas.setFocusPolicy( qt.QWidget.ClickFocus )
        self.canvas.setFocus()
        self.window.setCaption( "Figure %d" % num )

        qt.QObject.connect( self.window, qt.SIGNAL( 'destroyed()' ),
                            self._widgetclosed )
        self.window._destroying = False

        if matplotlib.rcParams['toolbar'] == 'classic':
            print "Classic toolbar is not yet supported"
            #self.toolbar = NavigationToolbarQT( centralWidget, canvas )
            self.toolbar = None
        elif matplotlib.rcParams['toolbar'] == 'toolbar2':
            self.toolbar = NavigationToolbar2QT( centralWidget, canvas )
        else:
            self.toolbar = None

        # Use a vertical layout for the plot and the toolbar.  Set the
        # stretch to all be in the plot so the toolbar doesn't resize.
        layout = qt.QVBoxLayout( centralWidget )
        layout.addWidget( self.canvas, 1 )
        if self.toolbar:
           layout.addWidget( self.toolbar, 0 )

        self.window.setCentralWidget( centralWidget )

        # Reset the window height so the canvas will be the right
        # size.  This ALMOST works right.  The first issue is that the
        # height w/ a toolbar seems to be off by just a little bit (so
        # we add 4 pixels).  The second is that the total width/height
        # is slightly smaller that we actually want.  It seems like
        # the border of the window is being included in the size but
        # AFAIK there is no way to get that size.  
        w = self.canvas.width()
        h = self.canvas.height()
        if self.toolbar:
           h += self.toolbar.height() + 4
        self.window.resize( w, h )
        
        if matplotlib.is_interactive():
            self.window.show()

        def notify_axes_change( fig ):
           # This will be called whenever the current axes is changed
           if self.toolbar != None: self.toolbar.update()
           self.canvas.figure.add_axobserver( notify_axes_change )
开发者ID:pv,项目名称:matplotlib-cvs,代码行数:58,代码来源:backend_qt.py

示例14: __init__

# 需要导入模块: from matplotlib.backend_bases import FigureManagerBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureManagerBase import __init__ [as 别名]
    def __init__(self, canvas, num):
        if DEBUG:
            print("FigureManagerQT.%s" % fn_name())
        FigureManagerBase.__init__(self, canvas, num)
        self.canvas = canvas
        self.window = qt.QMainWindow(None, None, qt.Qt.WDestructiveClose)
        self.window.closeEvent = self._widgetCloseEvent

        centralWidget = qt.QWidget(self.window)
        self.canvas.reparent(centralWidget, qt.QPoint(0, 0))

        # Give the keyboard focus to the figure instead of the manager
        self.canvas.setFocusPolicy(qt.QWidget.ClickFocus)
        self.canvas.setFocus()
        self.window.setCaption("Figure %d" % num)

        self.window._destroying = False

        self.toolbar = self._get_toolbar(self.canvas, centralWidget)

        # Use a vertical layout for the plot and the toolbar.  Set the
        # stretch to all be in the plot so the toolbar doesn't resize.
        self.layout = qt.QVBoxLayout(centralWidget)
        self.layout.addWidget(self.canvas, 1)

        if self.toolbar:
            self.layout.addWidget(self.toolbar, 0)

        self.window.setCentralWidget(centralWidget)

        # Reset the window height so the canvas will be the right
        # size.  This ALMOST works right.  The first issue is that the
        # height w/ a toolbar seems to be off by just a little bit (so
        # we add 4 pixels).  The second is that the total width/height
        # is slightly smaller that we actually want.  It seems like
        # the border of the window is being included in the size but
        # AFAIK there is no way to get that size.
        w = self.canvas.width()
        h = self.canvas.height()
        if self.toolbar:
            h += self.toolbar.height() + 4
        self.window.resize(w, h)

        if matplotlib.is_interactive():
            self.window.show()

        # attach a show method to the figure for pylab ease of use
        self.canvas.figure.show = lambda *args: self.window.show()

        def notify_axes_change(fig):
            # This will be called whenever the current axes is changed
            if self.toolbar != None:
                self.toolbar.update()

        self.canvas.figure.add_axobserver(notify_axes_change)
开发者ID:huard,项目名称:matplotlib,代码行数:57,代码来源:backend_qt.py

示例15: __init__

# 需要导入模块: from matplotlib.backend_bases import FigureManagerBase [as 别名]
# 或者: from matplotlib.backend_bases.FigureManagerBase import __init__ [as 别名]
    def __init__( self, canvas, num ):
        if DEBUG: print('FigureManagerQT.%s' % fn_name())
        FigureManagerBase.__init__( self, canvas, num )
        self.canvas = canvas
        self.window = QtGui.QMainWindow()
        self.window.setAttribute(QtCore.Qt.WA_DeleteOnClose)

        self.window.setWindowTitle("Figure %d" % num)
        image = os.path.join( matplotlib.rcParams['datapath'],'images','matplotlib.png' )
        self.window.setWindowIcon(QtGui.QIcon( image ))

        # Give the keyboard focus to the figure instead of the
        # manager; StrongFocus accepts both tab and click to focus and
        # will enable the canvas to process event w/o clicking.
        # ClickFocus only takes the focus is the window has been
        # clicked
        # on. http://developer.qt.nokia.com/doc/qt-4.8/qt.html#FocusPolicy-enum
        self.canvas.setFocusPolicy( QtCore.Qt.StrongFocus )
        self.canvas.setFocus()

        QtCore.QObject.connect( self.window, QtCore.SIGNAL( 'destroyed()' ),
                            self._widgetclosed )
        self.window._destroying = False

        self.toolbar = self._get_toolbar(self.canvas, self.window)
        if self.toolbar is not None:
            self.window.addToolBar(self.toolbar)
            QtCore.QObject.connect(self.toolbar, QtCore.SIGNAL("message"),
                                   self._show_message)
            tbs_height = self.toolbar.sizeHint().height()
        else:
            tbs_height = 0

        # resize the main window so it will display the canvas with the
        # requested size:
        cs = canvas.sizeHint()
        sbs = self.window.statusBar().sizeHint()
        self._status_and_tool_height = tbs_height+sbs.height()
        height = cs.height() + self._status_and_tool_height
        self.window.resize(cs.width(), height)

        self.window.setCentralWidget(self.canvas)

        if matplotlib.is_interactive():
            self.window.show()

        # attach a show method to the figure for pylab ease of use
        self.canvas.figure.show = lambda *args: self.window.show()

        def notify_axes_change( fig ):
            # This will be called whenever the current axes is changed
            if self.toolbar is not None:
                self.toolbar.update()
        self.canvas.figure.add_axobserver( notify_axes_change )
开发者ID:KennethNielsen,项目名称:matplotlib,代码行数:56,代码来源:backend_qt4.py


注:本文中的matplotlib.backend_bases.FigureManagerBase.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。