本文整理汇总了Python中guidata.qt.QtGui.QGridLayout.removeWidget方法的典型用法代码示例。如果您正苦于以下问题:Python QGridLayout.removeWidget方法的具体用法?Python QGridLayout.removeWidget怎么用?Python QGridLayout.removeWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类guidata.qt.QtGui.QGridLayout
的用法示例。
在下文中一共展示了QGridLayout.removeWidget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FitWidgetMixin
# 需要导入模块: from guidata.qt.QtGui import QGridLayout [as 别名]
# 或者: from guidata.qt.QtGui.QGridLayout import removeWidget [as 别名]
class FitWidgetMixin(CurveWidgetMixin):
def __init__(self, wintitle="guiqwt plot", icon="guiqwt.svg",
toolbar=False, options=None, panels=None, param_cols=1,
legend_anchor='TR', auto_fit=True):
if wintitle is None:
wintitle = _('Curve fitting')
self.x = None
self.y = None
self.fitfunc = None
self.fitargs = None
self.fitkwargs = None
self.fitparams = None
self.autofit_prm = None
self.data_curve = None
self.fit_curve = None
self.legend = None
self.legend_anchor = legend_anchor
self.xrange = None
self.show_xrange = False
self.param_cols = param_cols
self.auto_fit_enabled = auto_fit
self.button_list = [] # list of buttons to be disabled at startup
self.fit_layout = None
self.params_layout = None
CurveWidgetMixin.__init__(self, wintitle=wintitle, icon=icon,
toolbar=toolbar, options=options,
panels=panels)
self.refresh()
# QWidget API --------------------------------------------------------------
def resizeEvent(self, event):
QWidget.resizeEvent(self, event)
self.get_plot().replot()
# CurveWidgetMixin API -----------------------------------------------------
def setup_widget_layout(self):
self.fit_layout = QHBoxLayout()
self.params_layout = QGridLayout()
params_group = create_groupbox(self, _("Fit parameters"),
layout=self.params_layout)
if self.auto_fit_enabled:
auto_group = self.create_autofit_group()
self.fit_layout.addWidget(auto_group)
self.fit_layout.addWidget(params_group)
self.plot_layout.addLayout(self.fit_layout, 1, 0)
vlayout = QVBoxLayout(self)
vlayout.addWidget(self.toolbar)
vlayout.addLayout(self.plot_layout)
self.setLayout(vlayout)
def create_plot(self, options):
CurveWidgetMixin.create_plot(self, options)
for plot in self.get_plots():
plot.SIG_RANGE_CHANGED.connect(self.range_changed)
# Public API ---------------------------------------------------------------
def set_data(self, x, y, fitfunc=None, fitparams=None,
fitargs=None, fitkwargs=None):
if self.fitparams is not None and fitparams is not None:
self.clear_params_layout()
self.x = x
self.y = y
if fitfunc is not None:
self.fitfunc = fitfunc
if fitparams is not None:
self.fitparams = fitparams
if fitargs is not None:
self.fitargs = fitargs
if fitkwargs is not None:
self.fitkwargs = fitkwargs
self.autofit_prm = AutoFitParam(title=_("Automatic fitting options"))
self.autofit_prm.xmin = x.min()
self.autofit_prm.xmax = x.max()
self.compute_imin_imax()
if self.fitparams is not None and fitparams is not None:
self.populate_params_layout()
self.refresh()
def set_fit_data(self, fitfunc, fitparams, fitargs=None, fitkwargs=None):
if self.fitparams is not None:
self.clear_params_layout()
self.fitfunc = fitfunc
self.fitparams = fitparams
self.fitargs = fitargs
self.fitkwargs = fitkwargs
self.populate_params_layout()
self.refresh()
def clear_params_layout(self):
for i, param in enumerate(self.fitparams):
for widget in param.get_widgets():
if widget is not None:
self.params_layout.removeWidget(widget)
#.........这里部分代码省略.........