本文整理汇总了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()
示例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)
示例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()