本文整理汇总了Python中matplotlib.backends.qt_editor.formsubplottool.UiSubplotTool.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python UiSubplotTool.__init__方法的具体用法?Python UiSubplotTool.__init__怎么用?Python UiSubplotTool.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.qt_editor.formsubplottool.UiSubplotTool
的用法示例。
在下文中一共展示了UiSubplotTool.__init__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _update_dpi
# 需要导入模块: from matplotlib.backends.qt_editor.formsubplottool import UiSubplotTool [as 别名]
# 或者: from matplotlib.backends.qt_editor.formsubplottool.UiSubplotTool import __init__ [as 别名]
def _update_dpi(self):
# As described in __init__ above, we need to be careful in cases with
# mixed resolution displays if dpi_ratio is changing between painting
# events.
# Return whether we triggered a resizeEvent (and thus a paintEvent)
# from within this function.
if self._dpi_ratio != self._dpi_ratio_prev:
# We need to update the figure DPI.
self._update_figure_dpi()
self._dpi_ratio_prev = self._dpi_ratio
# The easiest way to resize the canvas is to emit a resizeEvent
# since we implement all the logic for resizing the canvas for
# that event.
event = QtGui.QResizeEvent(self.size(), self.size())
self.resizeEvent(event)
# resizeEvent triggers a paintEvent itself, so we exit this one
# (after making sure that the event is immediately handled).
return True
return False
示例2: __init__
# 需要导入模块: from matplotlib.backends.qt_editor.formsubplottool import UiSubplotTool [as 别名]
# 或者: from matplotlib.backends.qt_editor.formsubplottool.UiSubplotTool import __init__ [as 别名]
def __init__(self, figure):
if DEBUG:
print('FigureCanvasQt qt5: ', figure)
_create_qApp()
# NB: Using super for this call to avoid a TypeError:
# __init__() takes exactly 2 arguments (1 given) on QWidget
# PyQt5
super(FigureCanvasQT, self).__init__(figure=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)
示例3: _allow_super_init
# 需要导入模块: from matplotlib.backends.qt_editor.formsubplottool import UiSubplotTool [as 别名]
# 或者: from matplotlib.backends.qt_editor.formsubplottool.UiSubplotTool import __init__ [as 别名]
def _allow_super_init(__init__):
"""
Decorator for ``__init__`` to allow ``super().__init__`` on PyQt4/PySide2.
"""
if QT_API == "PyQt5":
return __init__
else:
# To work around lack of cooperative inheritance in PyQt4, PySide,
# and PySide2, when calling FigureCanvasQT.__init__, we temporarily
# patch QWidget.__init__ by a cooperative version, that first calls
# QWidget.__init__ with no additional arguments, and then finds the
# next class in the MRO with an __init__ that does support cooperative
# inheritance (i.e., not defined by the PyQt4, PySide, PySide2, sip
# or Shiboken packages), and manually call its `__init__`, once again
# passing the additional arguments.
qwidget_init = QtWidgets.QWidget.__init__
def cooperative_qwidget_init(self, *args, **kwargs):
qwidget_init(self)
mro = type(self).__mro__
next_coop_init = next(
cls for cls in mro[mro.index(QtWidgets.QWidget) + 1:]
if cls.__module__.split(".")[0] not in [
"PyQt4", "sip", "PySide", "PySide2", "Shiboken"])
next_coop_init.__init__(self, *args, **kwargs)
@functools.wraps(__init__)
def wrapper(self, *args, **kwargs):
with cbook._setattr_cm(QtWidgets.QWidget,
__init__=cooperative_qwidget_init):
__init__(self, *args, **kwargs)
return wrapper
示例4: __init__
# 需要导入模块: from matplotlib.backends.qt_editor.formsubplottool import UiSubplotTool [as 别名]
# 或者: from matplotlib.backends.qt_editor.formsubplottool.UiSubplotTool import __init__ [as 别名]
def __init__(self, *args, **kwargs):
TimerBase.__init__(self, *args, **kwargs)
# Create a new timer and connect the timeout() signal to the
# _on_timer method.
self._timer = QtCore.QTimer()
self._timer.timeout.connect(self._on_timer)
self._timer_set_interval()