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


Python QVBoxLayout.addStretch方法代码示例

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


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

示例1: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addStretch [as 别名]
    def __init__(self, fileInfo, parent=None):
        super().__init__(parent)

        fileNameLabel = QLabel(_("File Name")+':')
        fileNameEdit  = QLineEdit(fileInfo.fileName())

        pathLabel      = QLabel(_("Path")+':')
        pathValueLabel = QLabel(fileInfo.absoluteFilePath())
        pathValueLabel.setFrameStyle(LABEL_STYLE)

        sizeLabel = QLabel(_("Size")+':')
        size = fileInfo.size() // 1024
        sizeValueLabel = QLabel("%d Ko" % size)
        sizeValueLabel.setFrameStyle(LABEL_STYLE)

        lastModLabel = QLabel(_("Last Modified")+':')
        lastModValueLabel = QLabel(fileInfo.lastModified().toString())
        lastModValueLabel.setFrameStyle(LABEL_STYLE)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(fileNameLabel)
        mainLayout.addWidget(fileNameEdit)
        mainLayout.addWidget(pathLabel)
        mainLayout.addWidget(pathValueLabel)
        mainLayout.addWidget(sizeLabel)
        mainLayout.addWidget(sizeValueLabel)
        mainLayout.addWidget(lastModLabel)
        mainLayout.addWidget(lastModValueLabel)
        mainLayout.addStretch(1)
        self.setLayout(mainLayout)
开发者ID:papajoker,项目名称:pacmanInfo,代码行数:32,代码来源:application.py

示例2: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addStretch [as 别名]
    def __init__(self, url, color):
        QWidget.__init__(self)
        self.setStyleSheet("background-color: black")

        self.file_name_font = QFont()
        self.file_name_font.setPointSize(24)

        self.file_name_label = QLabel(self)
        self.file_name_label.setText(url)
        self.file_name_label.setFont(self.file_name_font)
        self.file_name_label.setAlignment(Qt.AlignCenter)
        self.file_name_label.setStyleSheet("color: #eee")

        self.qrcode_label = QLabel(self)

        self.notify_font = QFont()
        self.notify_font.setPointSize(12)
        self.notify_label = QLabel(self)
        self.notify_label.setText("Scan above QR to copy information")
        self.notify_label.setFont(self.notify_font)
        self.notify_label.setAlignment(Qt.AlignCenter)
        self.notify_label.setStyleSheet("color: #eee")

        layout = QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addStretch()
        layout.addWidget(self.qrcode_label, 0, Qt.AlignCenter)
        layout.addSpacing(20)
        layout.addWidget(self.file_name_label, 0, Qt.AlignCenter)
        layout.addSpacing(40)
        layout.addWidget(self.notify_label, 0, Qt.AlignCenter)
        layout.addStretch()

        self.qrcode_label.setPixmap(qrcode.make(url, image_factory=Image).pixmap())
开发者ID:mut0u,项目名称:emacs.d,代码行数:36,代码来源:buffer.py

示例3: export_history_dialog

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addStretch [as 别名]
 def export_history_dialog(self):
     d = WindowModalDialog(self, _('Export History'))
     d.setMinimumSize(400, 200)
     vbox = QVBoxLayout(d)
     defaultname = os.path.expanduser('~/vialectrum-history.csv')
     select_msg = _('Select file to export your wallet transactions to')
     hbox, filename_e, csv_button = filename_field(self, self.config, defaultname, select_msg)
     vbox.addLayout(hbox)
     vbox.addStretch(1)
     hbox = Buttons(CancelButton(d), OkButton(d, _('Export')))
     vbox.addLayout(hbox)
     #run_hook('export_history_dialog', self, hbox)
     self.update()
     if not d.exec_():
         return
     filename = filename_e.text()
     if not filename:
         return
     try:
         self.do_export_history(filename, csv_button.isChecked())
     except (IOError, os.error) as reason:
         export_error_label = _("Electrum was unable to produce a transaction export.")
         self.parent.show_critical(export_error_label + "\n" + str(reason), title=_("Unable to export history"))
         return
     self.parent.show_message(_("Your wallet history has been successfully exported."))
开发者ID:vialectrum,项目名称:vialectrum,代码行数:27,代码来源:history_list.py

示例4: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addStretch [as 别名]
 def __init__(self ):  
     super().__init__()
     
     #1        
     label1 = QLabel(self)
     label1.setToolTip('这是一个文本标签')
     label1.setStyleSheet("QLabel{border-image: url(./images/python.jpg);}")
     label1.setFixedWidth(476)
     label1.setFixedHeight(259)
     
     #2
     btn1 = QPushButton(self )  
     btn1.setObjectName('btn1')
     btn1.setMaximumSize(48, 48)
     btn1.setMinimumSize(48, 48)
     style = '''
                 #btn1{
                     border-radius: 4px;
                     background-image: url('./images/add.png');
                     }
                 #btn1:Pressed{
                     background-image: url('./images/addhover.png');
                     }
             '''
     btn1.setStyleSheet(style)
     
     #3
     vbox=QVBoxLayout()
     vbox.addWidget(label1)
     vbox.addStretch()
     vbox.addWidget(btn1)
   
     self.setLayout(vbox)
     self.setWindowTitle("按钮和Label添加背景图片例子")
开发者ID:kiorry,项目名称:PYQT,代码行数:36,代码来源:qt08_labelStyle.py

示例5: randomWidget

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addStretch [as 别名]
 def randomWidget(self):
     group = QGroupBox("Randomize")
     layout = QGridLayout()
     self.randomCount = QSpinBox()
     layout.addWidget(QLabel(self.tr("Count")), 0, 0)
     layout.addWidget(self.randomCount, 0, 1)
     self.minBrushSize = BrushSizeWidget(15)
     self.maxBrushSize = BrushSizeWidget(50)
     layout.addWidget(QLabel(self.tr("Min")), 1, 0)
     layout.addWidget(self.minBrushSize, 1, 1)
     layout.addWidget(QLabel(self.tr("Max")), 2, 0)
     layout.addWidget(self.maxBrushSize, 2, 1)
     self.xAngle = QSpinBox()
     self.yAngle = QSpinBox()
     self.zAngle = QSpinBox()
     layout.addWidget(QLabel(self.tr("Angle X")), 3, 0)
     layout.addWidget(self.xAngle, 3, 1)
     layout.addWidget(QLabel(self.tr("Angle Y")), 4, 0)
     layout.addWidget(self.yAngle, 4, 1)
     layout.addWidget(QLabel(self.tr("Angle Z")), 5, 0)
     layout.addWidget(self.zAngle, 5, 1)
     container = QVBoxLayout()
     container.addLayout(layout)
     container.addStretch(1)
     group.setLayout(container)
     group.setFixedWidth(150)
     return group
开发者ID:xsyann,项目名称:mediocre,代码行数:29,代码来源:dataset.py

示例6: init_ui

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addStretch [as 别名]
    def init_ui(self):
        """Initialize the Edit Widget"""
        plot_window_button = QPushButton('Select Plot Window', self)
        plot_window_button.clicked.connect(self.select_plot)
        plot_button = QPushButton('Plot Data', self)
        plot_button.clicked.connect(self.plot)
        color_button = QPushButton('Change Color', self)
        color_button.clicked.connect(lambda: self.plot_window.color_change(self.line_box))
        style_button = QPushButton('Change Style', self)
        style_button.clicked.connect(lambda: self.plot_window.line_style_change(self.line_box))
        remove_button = QPushButton('Remove Plot', self)
        remove_button.clicked.connect(lambda: self.plot_window.remove_plot(self.line_box))
        button_vertical_box = QVBoxLayout()
        button_vertical_box.addWidget(self.line_box)
        button_vertical_box.addStretch(1)
        button_vertical_box.addWidget(plot_window_button)
        button_vertical_box.addWidget(color_button)
        button_vertical_box.addWidget(style_button)
        button_vertical_box.addWidget(plot_button)
        button_vertical_box.addWidget(remove_button)

        main_horizontal_box = QHBoxLayout()
        main_horizontal_box.addLayout(button_vertical_box)
        self.setLayout(main_horizontal_box)
        self.setGeometry(self.left, self.top, self.width, self.height)
开发者ID:musebc,项目名称:pyplotgui,代码行数:27,代码来源:edit.py

示例7: GSideToolbar

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addStretch [as 别名]
class GSideToolbar(QWidget):
    selectionChanged = pyqtSignal(str)

    def __init__(self, buttons):
        super().__init__()

        self.selectedId = None

        self.mainLayout = QVBoxLayout(self)
        self.buttonGroup = QButtonGroup()
        self.buttons = {}

        for button in buttons:
            b = QPushButton(button.name)
            self.buttonGroup.addButton(b)
            self.buttonGroup.setId(b, button.id)
            self.buttons[button.id] = b
            self.mainLayout.addWidget(b)

        self.buttonGroup.buttonClicked.connect(self.buttonClicked)

        self.mainLayout.addStretch()

    def buttonState(self, state):
        pass

    def buttonClicked(self, button : QPushButton):
        buttonId = self.buttonGroup.id(button)
        buttonName = self.buttons[buttonId].text()
        self.selectionChanged.emit(buttonName)

    @staticmethod
    def createButton(text, icon):
        pass
开发者ID:dushko,项目名称:G-,代码行数:36,代码来源:gsidetoolbar.py

示例8: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addStretch [as 别名]
    def __init__(self, parent, settings_object):
        super().__init__()
        self.parent = parent
        self.settings_object = settings_object

        media_group = QGroupBox('Media Files')
        media_group_layout = QHBoxLayout()
        media_path_label = QLabel('Media Folder:')
        self.media_path_edit = QLineEdit(self.settings_object['output']['media_directory'])
        media_path_browse_button = QPushButton('Browse')

        media_path_browse_button.clicked.connect(self.browse_media_directory)
        self.media_path_edit.textEdited.connect(self.set_media_directory)

        media_group_layout.addWidget(media_path_label)
        media_group_layout.addWidget(self.media_path_edit)
        media_group_layout.addWidget(media_path_browse_button)
        media_group.setLayout(media_group_layout)

        schema_group = QGroupBox('Output File Naming Schema')

        main_layout = QVBoxLayout()
        main_layout.addWidget(media_group)
        main_layout.addWidget(schema_group)
        main_layout.addStretch(1)
        self.setLayout(main_layout)
开发者ID:Cjsheaf,项目名称:Handlebar,代码行数:28,代码来源:settings.py

示例9: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addStretch [as 别名]
    def __init__(self):
        """The constructor initializes the class AboutDialog."""
        super().__init__()
        self.setAttribute(Qt.WA_DeleteOnClose)

        # initialize class constants
        self._BUTTON_MIN_WIDTH = 110
        self._OXYGEN_PATH_48 = os.path.join("resources", "icons", "oxygen", "48")

        # fonts and margins settings
        hlFont = QFont()
        hlFont.setBold(True)
        hlFont.setPointSize(14)

        # scientific logo
        logo = QLabel(pixmap=QPixmap(os.path.join(self._OXYGEN_PATH_48, "applications-science.png")))

        logoLayout = QVBoxLayout()
        logoLayout.addWidget(logo)
        logoLayout.addStretch()

        # begin the content
        # headline and description text
        self.headline = QLabel()
        self.headline.setFont(hlFont)
        self.description = QLabel(wordWrap=True)

        # the list with the open button
        self.listWidget = QListWidget()
        self.listWidget.setMinimumWidth(420)
        self.createArticles()

        self.openButton = QPushButton()
        self.openButton.clicked.connect(self.openAction)

        listLayout = QHBoxLayout()
        listLayout.addWidget(self.listWidget)
        listLayout.addWidget(self.openButton, alignment=Qt.AlignTop)

        # create a close button
        line = QFrame(frameShadow=QFrame.Sunken, frameShape=QFrame.HLine)
        self.closeButton = QPushButton()
        self.closeButton.setFixedWidth(self._BUTTON_MIN_WIDTH)
        self.closeButton.clicked.connect(self.close)

        # content layout
        contentLayout = QVBoxLayout()
        contentLayout.addWidget(self.headline)
        contentLayout.addWidget(self.description)
        contentLayout.addLayout(listLayout)
        contentLayout.addWidget(line)
        contentLayout.addWidget(self.closeButton, alignment=Qt.AlignRight)

        # main layout
        layout = QHBoxLayout(self)
        layout.addLayout(logoLayout)
        layout.addLayout(contentLayout)

        # translate the graphical user interface
        self.retranslateUi()
开发者ID:tobiashelfenstein,项目名称:wuchshuellenrechner,代码行数:62,代码来源:dialog_about.py

示例10: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addStretch [as 别名]
    def __init__(self, parent=None):
        super(BasicFilterPage, self).__init__(parent)

        self.blockCombo = QComboBox()
        self.deviceCombo = QComboBox()
        self.unitCombo = QComboBox()

        self.combos = {'block': self.blockCombo, \
                       'device': self.deviceCombo, \
                       'unit': self.unitCombo}

        groupLayout = QFormLayout()
        groupLayout.addRow("Skupina měření:", self.blockCombo)
        groupLayout.addRow("Přístroj:", self.deviceCombo)
        groupLayout.addRow("Veličina:", self.unitCombo)

        filterGroup = QGroupBox("Základní filtry")
        filterGroup.setLayout(groupLayout)

        self.deviatedValuesCheckbox = QCheckBox()
        valuesLayout = QFormLayout()
        valuesLayout.addRow("Mimo odchylku:", self.deviatedValuesCheckbox)

        valuesGroup = QGroupBox("Hodnoty")
        valuesGroup.setLayout(valuesLayout)

        layout = QVBoxLayout()
        layout.addWidget(filterGroup)
        layout.addSpacing(12)
        layout.addWidget(valuesGroup)
        layout.addStretch(1)

        self.setLayout(layout)
开发者ID:johnymachine,项目名称:csv2db,代码行数:35,代码来源:filterdialog.py

示例11: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addStretch [as 别名]
    def __init__(self, parent=None):
        super(Login, self).__init__(parent)
        usr = QLabel(u"用户:")
        pwd = QLabel(u"密码:")
        self.usrLineEdit = QLineEdit()
        self.pwdLineEdit = QLineEdit()
        self.pwdLineEdit.setEchoMode(QLineEdit.Password)

        gridLayout = QGridLayout()
        gridLayout.addWidget(usr, 0, 0, 1, 1)
        gridLayout.addWidget(pwd, 1, 0, 1, 1)
        gridLayout.addWidget(self.usrLineEdit, 0, 1, 1, 3);
        gridLayout.addWidget(self.pwdLineEdit, 1, 1, 1, 3);

        okBtn = QPushButton(u"确定")
        cancelBtn = QPushButton(u"取消")
        btnLayout = QHBoxLayout()

        btnLayout.setSpacing(60)
        btnLayout.addWidget(okBtn)
        btnLayout.addWidget(cancelBtn)

        dlgLayout = QVBoxLayout()
        dlgLayout.setContentsMargins(40, 40, 40, 40)
        dlgLayout.addLayout(gridLayout)
        dlgLayout.addStretch(40)
        dlgLayout.addLayout(btnLayout)

        self.setLayout(dlgLayout)
        okBtn.clicked.connect(self.accept)
        cancelBtn.clicked.connect(self.reject)
        self.setWindowTitle(u"登录")
        self.resize(300, 200)
开发者ID:argen77,项目名称:vague,代码行数:35,代码来源:MainWindow.py

示例12: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addStretch [as 别名]
 def __init__(self):
     super().__init__()
     vbox = QVBoxLayout(self)
     self.setTitle("Python Project")
     frame = QFrame()
     frame.setLineWidth(2)
     vbox.addStretch(1)
     frame.setFrameShape(QFrame.StyledPanel)
     vbox.addWidget(frame)
     box = QGridLayout(frame)
     box.addWidget(QLabel("Project Name:"), 0, 0)
     self._line_project_name = QLineEdit()
     self.registerField("name*", self._line_project_name)
     box.addWidget(self._line_project_name, 0, 1)
     box.addWidget(QLabel("Create in:"), 1, 0)
     self.line = QLineEdit()
     self.registerField("path", self.line)
     choose_dir_action = self.line.addAction(
         QIcon(self.style().standardPixmap(
             self.style().SP_DirIcon)), QLineEdit.TrailingPosition)
     box.addWidget(self.line, 1, 1)
     box.addWidget(QLabel("Interpreter:"), 2, 0)
     line_interpreter = QComboBox()
     line_interpreter.setEditable(True)
     line_interpreter.addItems(utils.get_python())
     box.addWidget(line_interpreter, 2, 1)
     # from ninja_ide.utils import utils
     choose_dir_action.triggered.connect(self._choose_dir)
     self.line.setText(utils.get_home_dir())
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:31,代码来源:__bundled_project_types.py

示例13: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addStretch [as 别名]
    def __init__(self, parent, app):
        super().__init__()

        layout1 = QHBoxLayout()
        layout2 = QVBoxLayout()

        layout1.addStretch()
        layout1.addLayout(layout2)
        layout1.addStretch()

        label = QLabel(self)
        label.setText("Simple Project: <b>Display Environment Measurements on LCD</b>. Simply displays all measured values on LCD. Sources in all programming languages can be found <a href=\"http://www.tinkerforge.com/en/doc/Kits/WeatherStation/WeatherStation.html#display-environment-measurements-on-lcd\">here</a>.<br>")
        label.setTextFormat(Qt.RichText)
        label.setTextInteractionFlags(Qt.TextBrowserInteraction)
        label.setOpenExternalLinks(True)
        label.setWordWrap(True)
        label.setAlignment(Qt.AlignJustify)

        layout2.addSpacing(10)
        layout2.addWidget(label)
        layout2.addSpacing(10)

        self.lcdwidget = LCDWidget(self, app)

        layout2.addWidget(self.lcdwidget)
        layout2.addStretch()

        self.setLayout(layout1)

        self.qtcb_update_illuminance.connect(self.update_illuminance_data_slot)
        self.qtcb_update_air_pressure.connect(self.update_air_pressure_data_slot)
        self.qtcb_update_temperature.connect(self.update_temperature_data_slot)
        self.qtcb_update_humidity.connect(self.update_humidity_data_slot)
        self.qtcb_button_pressed.connect(self.button_pressed_slot)
开发者ID:Tinkerforge,项目名称:weather-station,代码行数:36,代码来源:Project_Env_Display.py

示例14: test_should_resize_to_match_height_for_width_when_user_enters_text

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addStretch [as 别名]
    def test_should_resize_to_match_height_for_width_when_user_enters_text(self):
        size_hint     = self.auto_resizing_text_edit.sizeHint()
        parent_height = size_hint.height() + 200

        layout = QVBoxLayout()
        layout.setSpacing(0)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.auto_resizing_text_edit)
        layout.addStretch()

        parent = QWidget()
        self.auto_resizing_text_edit.setParent(parent)

        parent.resize(size_hint.width(), parent_height)
        parent.setLayout(layout)

        # The window needs to get shown for the size changes to be propagated to layout.
        # Show it minimized to avoid stealing focus from the console running the tests.
        parent.showMinimized()

        assert self.auto_resizing_text_edit.height(), size_hint.height()
        assert self.auto_resizing_text_edit.width(),  parent.width()

        self.auto_resizing_text_edit.setPlainText('a\nb\nc\d')
        new_height_hint = self.auto_resizing_text_edit.heightForWidth(self.auto_resizing_text_edit.width())
        application.processEvents()

        self.assertNotEqual(new_height_hint, size_hint.height())
        self.assertEqual(self.auto_resizing_text_edit.height(), new_height_hint)
        self.assertEqual(self.auto_resizing_text_edit.width(),  parent.width())
开发者ID:cameel,项目名称:auto-resizing-text-edit,代码行数:32,代码来源:test_auto_resizing_text_edit.py

示例15: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addStretch [as 别名]
    def __init__(self):
        super().__init__()

        self.settings = QSettings('olle-orks.org', 'Bodenpython')

        self.setWindowTitle('Mikrokopter Bodenpython')
        self.communicator = None
        self.list_widget = None
        self.pingpong_widget = None
        self.serialport_selector = None

        saved_geometry = self.settings.value(self.SETTINGS_MAINWINDOW_GEOMETRY)
        if saved_geometry:
            self.restoreGeometry(saved_geometry)

        self.serialport_selector = SerialPortSelector(self.settings)
        self.serialport_selector.accepted.connect(self.serialport_selected)
        self.serialport_selector.rejected.connect(self.close)

        selector_layout = QHBoxLayout()
        selector_layout.addStretch()
        selector_layout.addWidget(self.serialport_selector)
        selector_layout.addStretch()

        central_widget = QWidget()
        central_layout = QVBoxLayout()
        central_layout.addStretch()
        central_layout.addLayout(selector_layout)
        central_layout.addStretch()
        central_widget.setLayout(central_layout)

        self.setCentralWidget(central_widget)

        QTimer.singleShot(0, self.set_window_icon)
开发者ID:Orksokopter,项目名称:groundstation,代码行数:36,代码来源:main_window.py


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