MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / __init__

Method __init__

lib/matplotlib/backends/backend_qt.py:584–622  ·  view source on GitHub ↗
(self, canvas, num)

Source from the content-addressed store, hash-verified

582 """
583
584 def __init__(self, canvas, num):
585 self.window = MainWindow()
586 super().__init__(canvas, num)
587 self.window.closing.connect(self._widgetclosed)
588
589 if sys.platform != "darwin":
590 image = str(cbook._get_data_path('images/matplotlib.svg'))
591 icon = QtGui.QIcon(image)
592 self.window.setWindowIcon(icon)
593
594 self.window._destroying = False
595
596 if self.toolbar:
597 self.window.addToolBar(self.toolbar)
598 tbs_height = self.toolbar.sizeHint().height()
599 else:
600 tbs_height = 0
601
602 # resize the main window so it will display the canvas with the
603 # requested size:
604 cs = canvas.sizeHint()
605 cs_height = cs.height()
606 height = cs_height + tbs_height
607 self.window.resize(cs.width(), height)
608
609 self.window.setCentralWidget(self.canvas)
610
611 if mpl.is_interactive():
612 self.window.show()
613 self.canvas.draw_idle()
614
615 # Give the keyboard focus to the figure instead of the manager:
616 # StrongFocus accepts both tab and click to focus and will enable the
617 # canvas to process event without clicking.
618 # https://doc.qt.io/qt-5/qt.html#FocusPolicy-enum
619 self.canvas.setFocusPolicy(QtCore.Qt.FocusPolicy.StrongFocus)
620 self.canvas.setFocus()
621
622 self.window.raise_()
623
624 def full_screen_toggle(self):
625 if self.window.isFullScreen():

Callers

nothing calls this directly

Calls 9

MainWindowClass · 0.85
heightMethod · 0.80
sizeHintMethod · 0.80
widthMethod · 0.80
__init__Method · 0.45
connectMethod · 0.45
resizeMethod · 0.45
showMethod · 0.45
draw_idleMethod · 0.45

Tested by

no test coverage detected