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


Python UiSubplotTool.__init__方法代码示例

本文整理汇总了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__方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from matplotlib.backends.qt_editor.formsubplottool import UiSubplotTool [as 别名]
# 或者: from matplotlib.backends.qt_editor.formsubplottool.UiSubplotTool import __init__ [as 别名]
    def __init__(self, targetfig, parent):
        UiSubplotTool.__init__(self, None)

        self.targetfig = targetfig
        self.parent = parent
        self.donebutton.clicked.connect(self.close)
        self.resetbutton.clicked.connect(self.reset)
        self.tightlayout.clicked.connect(self.functight)

        # constraints
        self.sliderleft.valueChanged.connect(self.sliderright.setMinimum)
        self.sliderright.valueChanged.connect(self.sliderleft.setMaximum)
        self.sliderbottom.valueChanged.connect(self.slidertop.setMinimum)
        self.slidertop.valueChanged.connect(self.sliderbottom.setMaximum)

        self.defaults = {}
        for attr in ('left', 'bottom', 'right', 'top', 'wspace', 'hspace', ):
            self.defaults[attr] = getattr(self.targetfig.subplotpars, attr)
            slider = getattr(self, 'slider' + attr)
            slider.setMinimum(0)
            slider.setMaximum(1000)
            slider.setSingleStep(5)
            slider.valueChanged.connect(getattr(self, 'func' + attr))

        self._setSliderPositions()
开发者ID:Acanthostega,项目名称:matplotlib,代码行数:27,代码来源:backend_qt5.py

示例2: __init__

# 需要导入模块: from matplotlib.backends.qt_editor.formsubplottool import UiSubplotTool [as 别名]
# 或者: from matplotlib.backends.qt_editor.formsubplottool.UiSubplotTool import __init__ [as 别名]
    def __init__(self, targetfig, parent):
        UiSubplotTool.__init__(self, None)

        self._figure = targetfig

        for lower, higher in [("bottom", "top"), ("left", "right")]:
            self._widgets[lower].valueChanged.connect(
                lambda val: self._widgets[higher].setMinimum(val + .001))
            self._widgets[higher].valueChanged.connect(
                lambda val: self._widgets[lower].setMaximum(val - .001))

        self._attrs = ["top", "bottom", "left", "right", "hspace", "wspace"]
        self._defaults = {attr: vars(self._figure.subplotpars)[attr]
                          for attr in self._attrs}

        # Set values after setting the range callbacks, but before setting up
        # the redraw callbacks.
        self._reset()

        for attr in self._attrs:
            self._widgets[attr].valueChanged.connect(self._on_value_changed)
        for action, method in [("Export values", self._export_values),
                               ("Tight layout", self._tight_layout),
                               ("Reset", self._reset),
                               ("Close", self.close)]:
            self._widgets[action].clicked.connect(method)
开发者ID:endolith,项目名称:matplotlib,代码行数:28,代码来源:backend_qt5.py

示例3: __init__

# 需要导入模块: from matplotlib.backends.qt_editor.formsubplottool import UiSubplotTool [as 别名]
# 或者: from matplotlib.backends.qt_editor.formsubplottool.UiSubplotTool import __init__ [as 别名]
    def __init__(self, targetfig, parent):
        UiSubplotTool.__init__(self, None)

        self.targetfig = targetfig
        self.parent = parent
        self.donebutton.clicked.connect(self.close)
        self.resetbutton.clicked.connect(self.reset)
        self.tightlayout.clicked.connect(self.functight)

        # constraints
        self.sliderleft.valueChanged.connect(self.sliderright.setMinimum)
        self.sliderright.valueChanged.connect(self.sliderleft.setMaximum)
        self.sliderbottom.valueChanged.connect(self.slidertop.setMinimum)
        self.slidertop.valueChanged.connect(self.sliderbottom.setMaximum)

        self.defaults = {}
        for attr in ('left', 'bottom', 'right', 'top', 'wspace', 'hspace', ):
            val = getattr(self.targetfig.subplotpars, attr)
            self.defaults[attr] = val
            slider = getattr(self, 'slider' + attr)
            txt = getattr(self, attr + 'value')
            slider.setMinimum(0)
            slider.setMaximum(1000)
            slider.setSingleStep(5)
            # do this before hooking up the callbacks
            slider.setSliderPosition(int(val * 1000))
            txt.setText("%.2f" % val)
            slider.valueChanged.connect(getattr(self, 'func' + attr))
        self._setSliderPositions()
开发者ID:kshramt,项目名称:matplotlib,代码行数:31,代码来源:backend_qt5.py


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