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


Python QtWidgets.QVBoxLayout方法代码示例

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


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

示例1: setGraphView

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QVBoxLayout [as 别名]
def setGraphView(self, graphView):

        self.graphView = graphView

        # Setup Layout
        layout = QtWidgets.QVBoxLayout(self)
        layout.addWidget(self.graphView)
        self.setLayout(layout)

        #########################
        ## Setup hotkeys for the following actions.
        deleteShortcut = QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Delete), self)
        deleteShortcut.activated.connect(self.graphView.deleteSelectedNodes)

        frameShortcut = QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_F), self)
        frameShortcut.activated.connect(self.graphView.frameSelectedNodes)

        frameShortcut = QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_A), self)
        frameShortcut.activated.connect(self.graphView.frameAllNodes) 
开发者ID:EricTRocks,项目名称:pyflowgraph,代码行数:21,代码来源:graph_view_widget.py

示例2: __init__

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QVBoxLayout [as 别名]
def __init__(self, parent, port, path='~', font=None, theme=None,
                 color_scheme=None):
        """Frame main constructor."""
        QWidget.__init__(self, parent)
        url = 'http://127.0.0.1:{0}?path={1}'.format(port, path)
        self.handler = ChannelHandler(self)
        self.handler.sig_ready.connect(lambda: self.terminal_ready.emit())
        self.handler.sig_closed.connect(lambda: self.terminal_closed.emit())
        self.view = TermView(self, parent.CONF,
                             term_url=url, handler=self.handler)
        self.font = font
        self.initial_path = path
        self.theme = theme
        self.color_scheme = color_scheme
        self.parent = parent
        self.shortcuts = self.create_shortcuts()
        layout = QVBoxLayout()
        layout.addWidget(self.view)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken)
        self.setLayout(layout)

        self.body = self.view.document

        self.handler.sig_ready.connect(self.setup_term) 
开发者ID:spyder-ide,项目名称:spyder-terminal,代码行数:27,代码来源:terminalgui.py

示例3: __init__

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QVBoxLayout [as 别名]
def __init__(self, parent):
        """
        Initialize plugin and corresponding widget.

        The part of the initialization that depends on `parent` is done in
        `self.register_plugin()`.
        """
        SpyderPluginWidget.__init__(self, parent)

        # Create unit test widget and add to dockwindow
        self.unittestwidget = UnitTestWidget(
            self.main,
            options_button=self.options_button,
            options_menu=self._options_menu)
        layout = QVBoxLayout()
        layout.addWidget(self.unittestwidget)
        self.setLayout(layout) 
开发者ID:spyder-ide,项目名称:spyder-unittest,代码行数:19,代码来源:unittestplugin.py

示例4: test_add_dock_widget_from_list

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QVBoxLayout [as 别名]
def test_add_dock_widget_from_list(make_test_viewer):
    """Test that we can add a list of widgets and they will be combined"""
    viewer = make_test_viewer()
    widg = QPushButton('button')
    widg2 = QPushButton('button')

    dwidg = viewer.window.add_dock_widget(
        [widg, widg2], name='test', area='right'
    )
    assert viewer.window._qt_window.findChild(QDockWidget, 'test')
    assert isinstance(dwidg.widget.layout, QVBoxLayout)

    dwidg = viewer.window.add_dock_widget(
        [widg, widg2], name='test2', area='bottom'
    )
    assert viewer.window._qt_window.findChild(QDockWidget, 'test2')
    assert isinstance(dwidg.widget.layout, QHBoxLayout) 
开发者ID:napari,项目名称:napari,代码行数:19,代码来源:test_qt_dock_widget.py

示例5: create_layout

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QVBoxLayout [as 别名]
def create_layout(self):
        '''
        Create the layouts and add widgets
        '''
        check_box_layout = QtWidgets.QHBoxLayout()
        check_box_layout.setContentsMargins(2, 2, 2, 2)

        main_layout = QtWidgets.QVBoxLayout()
        main_layout.setContentsMargins(6, 6, 6, 6)

        main_layout.addWidget(self.descriptionLabel)
        main_layout.addWidget(self.descriptionWidget)
        main_layout.addWidget(self.tableWidget)

        main_layout.addWidget(self.chkboxLockedWidget)
        main_layout.addWidget(self.submitBtn)

        # main_layout.addStretch()

        self.setLayout(main_layout) 
开发者ID:TomMinor,项目名称:P4VFX,代码行数:22,代码来源:SubmitChangeWindow.py

示例6: create_layout

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QVBoxLayout [as 别名]
def create_layout(self):
        '''
        Create the layouts and add widgets
        '''
        check_box_layout = QtWidgets.QHBoxLayout()
        check_box_layout.setContentsMargins(2, 2, 2, 2)

        main_layout = QtWidgets.QVBoxLayout()
        main_layout.setContentsMargins(6, 6, 6, 6)

        main_layout.addWidget(self.fileTree)
        main_layout.addWidget(self.tableWidget)

        bottomLayout = QtWidgets.QHBoxLayout()
        bottomLayout.addWidget(self.getRevisionBtn)
        bottomLayout.addSpacerItem(QtWidgets.QSpacerItem(20, 16))
        bottomLayout.addWidget(self.getPreviewBtn)
        bottomLayout.addSpacerItem(QtWidgets.QSpacerItem(20, 16))
        bottomLayout.addWidget(self.getLatestBtn)

        main_layout.addLayout(bottomLayout)
        main_layout.addWidget(self.horizontalLine)
        main_layout.addWidget(self.statusBar)

        self.setLayout(main_layout) 
开发者ID:TomMinor,项目名称:P4VFX,代码行数:27,代码来源:FileRevisionWindow.py

示例7: create_layout

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QVBoxLayout [as 别名]
def create_layout(self):
        '''
        Create the layouts and add widgets
        '''
        check_box_layout = QtWidgets.QHBoxLayout()
        check_box_layout.setContentsMargins(2, 2, 2, 2)

        main_layout = QtWidgets.QVBoxLayout()
        main_layout.setContentsMargins(6, 6, 6, 6)

        main_layout.addWidget(self.tableWidget)

        bottomLayout = QtWidgets.QHBoxLayout()
        bottomLayout.addWidget(self.revertFileBtn)
        bottomLayout.addWidget(self.refreshBtn)
        bottomLayout.addSpacerItem(QtWidgets.QSpacerItem(400, 16))
        bottomLayout.addWidget(self.openSelectedBtn)

        main_layout.addLayout(bottomLayout)

        self.setLayout(main_layout) 
开发者ID:TomMinor,项目名称:P4VFX,代码行数:23,代码来源:OpenedFilesWindow.py

示例8: __init__

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QVBoxLayout [as 别名]
def __init__(
        self,
        title: str,
        algorithm_data: Sequence[Mapping[str, Any]],
        parent: QWidget
    ):
        """Add three tabs of chart."""
        super(ChartDialog, self).__init__(parent)
        self.setWindowTitle("Chart")
        self.setWindowFlags(self.windowFlags() | Qt.WindowMaximizeButtonHint)
        self.setSizeGripEnabled(True)
        self.setModal(True)
        self.setMinimumSize(QSize(800, 600))
        self.title = title
        self.algorithm_data = algorithm_data
        # Widgets
        main_layout = QVBoxLayout(self)
        main_layout.setContentsMargins(6, 6, 6, 6)
        self.tab_widget = QTabWidget(self)
        self.__set_chart("F-G Plot", 0, 1, 'Generation', 'Fitness')
        self.__set_chart("G-T Plot", 2, 0, 'Time', 'Generation')
        self.__set_chart("F-T Plot", 2, 1, 'Time', 'Fitness')
        main_layout.addWidget(self.tab_widget) 
开发者ID:KmolYuan,项目名称:Pyslvs-UI,代码行数:25,代码来源:chart.py

示例9: __init__

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QVBoxLayout [as 别名]
def __init__(self, parent: QWidget, row: int = 1, col: int = 1,
                 polar: bool = False):
        """Input title and two axises, QChart class has no parent."""
        super(DataChart, self).__init__(parent)
        layout = QVBoxLayout(self)
        figure = Figure()
        canvas = FigureCanvasQTAgg(figure)
        layout.addWidget(NavigationToolbar2QT(canvas, self))
        layout.addWidget(canvas)
        self._ax = []
        for i in range(1, row * col + 1):
            self._ax.append(figure.add_subplot(row, col, i, polar=polar))

        def set_margin(m: float) -> None:
            figure.tight_layout(pad=m)

        self.set_margin = set_margin 
开发者ID:KmolYuan,项目名称:Pyslvs-UI,代码行数:19,代码来源:chart.py

示例10: __init__

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QVBoxLayout [as 别名]
def __init__(self, parent, channels, selected=None, title="Pick channels"):
        super().__init__(parent)
        self.setWindowTitle(title)
        if selected is None:
            selected = []
        self.initial_selection = selected
        vbox = QVBoxLayout(self)
        self.channels = QListWidget()
        self.channels.insertItems(0, channels)
        self.channels.setSelectionMode(QListWidget.ExtendedSelection)
        for i in range(self.channels.count()):
            if self.channels.item(i).data(0) in selected:
                self.channels.item(i).setSelected(True)
        vbox.addWidget(self.channels)
        self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok |
                                          QDialogButtonBox.Cancel)
        vbox.addWidget(self.buttonbox)
        self.buttonbox.accepted.connect(self.accept)
        self.buttonbox.rejected.connect(self.reject)
        self.channels.itemSelectionChanged.connect(self.toggle_buttons)
        self.toggle_buttons()  # initialize OK button state 
开发者ID:cbrnr,项目名称:mnelab,代码行数:23,代码来源:pickchannelsdialog.py

示例11: __init__

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QVBoxLayout [as 别名]
def __init__(self, module, attribute_name, widget_name=None):
        super(BaseAttributeWidget, self).__init__()
        self.module = module
        self.attribute_name = attribute_name
        if widget_name is None:
            self.widget_name = self.attribute_name
        else:
            self.widget_name = widget_name
        self.setToolTip(self.attribute_descriptor.__doc__)
        self.layout_v = QtWidgets.QVBoxLayout()
        self.layout = self.layout_v
        if self.widget_name != "":
            self.label = QtWidgets.QLabel(self.widget_name)
            self.layout.addWidget(self.label, 0) # stretch=0
            self.layout.addStretch(1)
        self.layout_v.setContentsMargins(0, 0, 0, 0)
        self._make_widget()
        self.layout.addWidget(self.widget, 0) # stretch=0
        self.layout.addStretch(1)
        self.setLayout(self.layout)
        self.write_attribute_value_to_widget()
        # this is very nice for debugging, but should probably be removed later
        setattr(self.module, '_'+self.attribute_name+'_widget', self) 
开发者ID:lneuhaus,项目名称:pyrpl,代码行数:25,代码来源:attribute_widgets.py

示例12: set_max_cols

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QVBoxLayout [as 别名]
def set_max_cols(self, n_cols):
        """
        If more than n boxes are required, go to next line
        """
        if len(self.combos)<=n_cols:
            return
        for item in self.combos:
            self.lay.removeWidget(item)
        self.v_layouts = []
        n = len(self.combos)
        n_rows = int(np.ceil(n*1.0/n_cols))
        j = 0
        for i in range(n_cols):
            layout = QtWidgets.QVBoxLayout()
            self.lay.addLayout(layout)
            for j in range(n_rows):
                index = i*n_rows + j
                if index>=n:
                    break
                layout.addWidget(self.combos[index]) 
开发者ID:lneuhaus,项目名称:pyrpl,代码行数:22,代码来源:attribute_widgets.py

示例13: __init__

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QVBoxLayout [as 别名]
def __init__(self, widget_name, y, label, parent, x_offset=0):
        super(MyItem, self).__init__()
        self.lay = QtWidgets.QVBoxLayout()
        self.setLayout(self.lay)
        self.item = QtWidgets.QLabel(label)
        self.setStyleSheet('background-color:transparent')
        self.lay.addWidget(self.item)

        self.widget_name = widget_name
        self.y = y
        self.x_offset = x_offset
        self.parent = parent
        parent.graphic_items.append(self)
        self.item.setStyleSheet(
            "QLabel{border: 1px solid black; border-radius: 5px; "
            "font-size: 15px; background-color:white}")
        self.proxy = parent.scene.addWidget(self)
        self.proxy.setZValue(2) 
开发者ID:lneuhaus,项目名称:pyrpl,代码行数:20,代码来源:schematics.py

示例14: __init__

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QVBoxLayout [as 别名]
def __init__(self, parent):
        super(WidgetManual, self).__init__(parent)
        self.parent = parent
        self.layout = QtWidgets.QVBoxLayout(self)
        self.pv1 = QtWidgets.QVBoxLayout()
        self.pv2 = QtWidgets.QVBoxLayout()
        self.layout.addLayout(self.pv1)
        self.layout.addLayout(self.pv2)
        self.p = parent.parent.attribute_widgets["p"]
        self.i = parent.parent.attribute_widgets["i"]

        self.p.label.setText('proportional gain (1)')
        self.i.label.setText('integral unity-gain (Hz)')
        #self.p.label.setFixedWidth(24)
        #self.i.label.setFixedWidth(24)
        # self.p.adjustSize()
        # self.i.adjustSize()
        for prop in self.p, self.i:
            prop.widget.set_log_increment()
        self.pv1.addWidget(self.p)
        self.pv2.addWidget(self.i)
        # self.i.label.setMinimumWidth(6) 
开发者ID:lneuhaus,项目名称:pyrpl,代码行数:24,代码来源:lockbox_widget.py

示例15: init_gui

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QVBoxLayout [as 别名]
def init_gui(self):
        #self.main_layout = QtWidgets.QVBoxLayout(self)
        self.init_main_layout(orientation="vertical")
        self.init_attribute_layout()

        self.win = pg.GraphicsWindow(title="Expected signal")
        self.plot_item = self.win.addPlot(title='Expected ' + self.module.name)
        self.plot_item.showGrid(y=True, x=True, alpha=1.)
        self.curve = self.plot_item.plot(pen='y')
        self.curve_slope = self.plot_item.plot(pen=pg.mkPen('b', width=5))
        self.symbol = self.plot_item.plot(pen='b', symbol='o')
        self.main_layout.addWidget(self.win)
        self.button_calibrate = QtWidgets.QPushButton('Calibrate')
        self.main_layout.addWidget(self.button_calibrate)
        self.button_calibrate.clicked.connect(lambda: self.module.calibrate())
        self.input_calibrated() 
开发者ID:lneuhaus,项目名称:pyrpl,代码行数:18,代码来源:lockbox_widget.py


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