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


Python QWidget.setMaximumWidth方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QWidget.setMaximumWidth方法的典型用法代码示例。如果您正苦于以下问题:Python QWidget.setMaximumWidth方法的具体用法?Python QWidget.setMaximumWidth怎么用?Python QWidget.setMaximumWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QWidget的用法示例。


在下文中一共展示了QWidget.setMaximumWidth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setMaximumWidth [as 别名]
    def __init__(self, ispec, parent=None, **kwargs):
        """
        Parameters
        ----------
        lbl : str
        format : str
          Format for value
        """
        super(ExSpecDialog, self).__init__(parent)

        # Grab the pieces and tie together
        self.pltline_widg = ltgl.PlotLinesWidget(status=None, init_z=0.)
        self.pltline_widg.setMaximumWidth(300)
        # Grab the Widget
        #QtCore.pyqtRemoveInputHook()
        #pdb.set_trace()
        #QtCore.pyqtRestoreInputHook()
        self.spec_widg = ExamineSpecWidget(ispec, llist=self.pltline_widg.llist, zsys=0., **kwargs)
        self.spec_widg.canvas.mpl_connect('button_press_event', self.on_click)
        # Layout
        rside = QWidget()
        rside.setMaximumWidth(300)
        vbox = QVBoxLayout()
        qbtn = QPushButton(self)
        qbtn.setText('Quit')
        qbtn.clicked.connect(self.quit)
        vbox.addWidget(self.pltline_widg)
        vbox.addWidget(qbtn)
        rside.setLayout(vbox)

        hbox = QHBoxLayout()
        hbox.addWidget(self.spec_widg)
        hbox.addWidget(rside)
        self.setLayout(hbox)
开发者ID:lwymarie,项目名称:linetools,代码行数:36,代码来源:spec_widgets.py

示例2: add_grid_widget

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setMaximumWidth [as 别名]
 def add_grid_widget(self, width):
     widget = QWidget()
     widget.setMaximumWidth(width)
     grid_layout = QGridLayout()
     widget.setLayout(grid_layout)
     grid_layout.setSpacing(4)
     grid_layout.setContentsMargins(4, 4, 4, 4)
     self.contentLayout.addWidget(widget)
     grid_layout.setAlignment(Qt.AlignTop | Qt.AlignLeft)
     return grid_layout
开发者ID:pracedru,项目名称:pyDesign,代码行数:12,代码来源:RibbonPane.py

示例3: __init__

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setMaximumWidth [as 别名]
    def __init__(self, ispec, parent=None, zsys=None, norm=None, exten=None,
                 rsp_kwargs={}, unit_test=False, **kwargs):
        QMainWindow.__init__(self, parent)
        """
        ispec = str, XSpectrum1D or tuple of arrays
          Input spectrum or spectrum filename.  If tuple then (wave,
          fx), (wave, fx, sig) or (wave, fx, sig, co)
        parent : Widget parent, optional
        zsys : float, optional
          intial redshift
        exten : int, optional
          extension for the spectrum in multi-extension FITS file
        norm : bool, optional
          True if the spectrum is normalized
        """
        #reload(ltgl)
        #reload(ltgsp)
        # INIT
        #QtCore.pyqtRemoveInputHook()
        #xdb.set_trace()
        #QtCore.pyqtRestoreInputHook()

        # Needed to avoid crash in large spectral files
        rcParams['agg.path.chunksize'] = 20000
        rcParams['axes.formatter.useoffset'] = False  # avoid scientific notation in axes tick labels

        # Build a widget combining several others
        self.main_widget = QWidget()

        # Status bar
        self.create_status_bar()

        # Grab the pieces and tie together
        self.pltline_widg = ltgl.PlotLinesWidget(status=self.statusBar, init_z=zsys)
        self.pltline_widg.setMaximumWidth(300)

        # Hook the spec widget to Plot Line
        self.spec_widg = ltgsp.ExamineSpecWidget(ispec,status=self.statusBar,
                                                 parent=self,
                                                llist=self.pltline_widg.llist,
                                                zsys=zsys, norm=norm, exten=exten,
                                                 rsp_kwargs=rsp_kwargs, **kwargs)
        self.pltline_widg.spec_widg = self.spec_widg

        self.spec_widg.canvas.mpl_connect('button_press_event', self.on_click)

        extras = QWidget()
        extras.setMaximumWidth(130)
        vbox = QVBoxLayout()
        qbtn = QPushButton(self)
        qbtn.setText('Quit')
        qbtn.clicked.connect(self.quit)
        vbox.addWidget(self.pltline_widg)
        vbox.addWidget(qbtn)
        extras.setLayout(vbox)

        hbox = QHBoxLayout()
        hbox.addWidget(self.spec_widg)
        hbox.addWidget(extras)

        self.main_widget.setLayout(hbox)

        # Point MainWindow
        self.setCentralWidget(self.main_widget)
        if unit_test:
            self.quit()
开发者ID:lwymarie,项目名称:linetools,代码行数:68,代码来源:xspecgui.py

示例4: __init__

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setMaximumWidth [as 别名]
    def __init__(self, ispec, abs_sys, parent=None, llist=None, norm=True,
                 vmnx=[-300., 300.]*u.km/u.s, outfil=None):
        """
        spec : Filename or Spectrum1D
        abs_sys : AbsSystem
          Absorption system class
        Norm : bool, optional
          Normalized spectrum?
        """
        from linetools.guis import spec_widgets as ltgs
        super(XAbsSysGui, self).__init__(parent)

        # Initialize
        self.abs_sys = abs_sys
        self.z = self.abs_sys.zabs
        abs_lines = abs_sys.list_of_abslines()
        self.vmnx = vmnx
        if outfil is None:
            self.outfil = 'tmp_abskin.json'
            warnings.warn("Outfil not specified.  Using {:s} as the default".format(self.outfil))
        else:
            self.outfil = outfil
        self.norm = norm

        # Grab the pieces and tie together
        newfont = QtGui.QFont("Times", 10, QtGui.QFont.Bold)
        sys_label = QLabel('Name: \n {:s}'.format(abs_sys.name))
        sys_label.setFont(newfont)
        self.vplt_widg = ltgs.VelPlotWidget(ispec, self.z, abs_lines=abs_lines, llist=llist,
                                            vmnx=self.vmnx, norm=self.norm)
        self.pltline_widg = ltgl.PlotLinesWidget(init_llist=self.vplt_widg.llist,
                                                 init_z=self.z, edit_z=False)
        #self.pltline_widg.spec_widg = self.vplt_widg

        self.slines = ltgl.SelectedLinesWidget(self.vplt_widg.llist[self.vplt_widg.llist['List']],
                                               init_select=self.vplt_widg.llist['show_line'],
                                               plot_widget=self.vplt_widg)

        # Connections
        self.pltline_widg.llist_widget.currentItemChanged.connect(self.on_llist_change)
        #self.connect(self.pltline_widg.zbox, QtCore.SIGNAL('editingFinished ()'), self.setz)
        self.vplt_widg.canvas.mpl_connect('key_press_event', self.on_key)

        # Outfil
        wbtn = QPushButton(self)
        wbtn.setText('Write')
        wbtn.setAutoDefault(False)
        wbtn.clicked.connect(self.write_out)
        self.out_box = QLineEdit()
        self.out_box.setText(self.outfil)
        self.out_box.textChanged[str].connect(self.set_outfil)
        #self.connect(self.out_box, QtCore.SIGNAL('editingFinished ()'), self.set_outfil)

        #QtCore.pyqtRemoveInputHook()
        #pdb.set_trace()
        #QtCore.pyqtRestoreInputHook()

        # Quit
        buttons = QWidget()
        wqbtn = QPushButton(self)
        wqbtn.setText('Write+Quit')
        wqbtn.setAutoDefault(False)
        wqbtn.clicked.connect(self.write_quit)
        qbtn = QPushButton(self)
        qbtn.setText('Quit')
        qbtn.setAutoDefault(False)
        qbtn.clicked.connect(self.quit)

        # Sizes
        lines_widg = QWidget()
        lines_widg.setMaximumWidth(300)
        lines_widg.setMinimumWidth(200)

        # Layout
        vbox = QVBoxLayout()
        vbox.addWidget(sys_label)
        vbox.addWidget(self.pltline_widg)
        vbox.addWidget(self.slines)
        vbox.addWidget(wbtn)
        vbox.addWidget(self.out_box)
        # Write/Quit buttons
        hbox1 = QHBoxLayout()
        hbox1.addWidget(wqbtn)
        hbox1.addWidget(qbtn)
        buttons.setLayout(hbox1)
        #
        vbox.addWidget(buttons)
        lines_widg.setLayout(vbox)

        hbox = QHBoxLayout()
        hbox.addWidget(self.vplt_widg)
        hbox.addWidget(lines_widg)

        self.setLayout(hbox)
        # Initial draw
        self.vplt_widg.on_draw()
开发者ID:linetools,项目名称:linetools,代码行数:98,代码来源:xabssysgui.py


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