本文整理汇总了Python中PyQt5.QtWidgets.QVBoxLayout.addLayout方法的典型用法代码示例。如果您正苦于以下问题:Python QVBoxLayout.addLayout方法的具体用法?Python QVBoxLayout.addLayout怎么用?Python QVBoxLayout.addLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QVBoxLayout
的用法示例。
在下文中一共展示了QVBoxLayout.addLayout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addLayout [as 别名]
def __init__(self, gallery, tuple_first_idx, text=None, parent = None):
super().__init__(parent, flags= Qt.Dialog | Qt.FramelessWindowHint)
main_layout = QVBoxLayout()
self.main_widget.setLayout(main_layout)
g_showcase = GalleryShowcaseWidget()
g_showcase.set_gallery(gallery, (170//1.40, 170))
if text:
t_layout = QHBoxLayout()
main_layout.addLayout(t_layout)
t_layout.addWidget(g_showcase, 1)
info = QLabel(text)
info.setWordWrap(True)
t_layout.addWidget(info)
else:
main_layout.addWidget(g_showcase, 0, Qt.AlignCenter)
self.list_w = QListWidget(self)
main_layout.addWidget(self.list_w, 3)
main_layout.addLayout(self.buttons_layout)
for t in tuple_first_idx:
item = GalleryListItem(t)
item.setText(t[0])
self.list_w.addItem(item)
buttons = self.add_buttons('Choose')
buttons[0].clicked.connect(self.finish)
self.resize(400, 400)
self.show()
示例2: __init__
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addLayout [as 别名]
def __init__(self, parent=None):
super(ResultHandler, self).__init__()
self.setWindowTitle('Dash results')
self.control_label = QLabel()
self.rendered_label = QLabel()
self.diff_label = QLabel()
self.mask_label = QLabel()
self.new_mask_label = QLabel()
self.scrollArea = QScrollArea()
self.widget = QWidget()
self.test_name_label = QLabel()
grid = QGridLayout()
grid.addWidget(self.test_name_label, 0, 0)
grid.addWidget(QLabel('Control'), 1, 0)
grid.addWidget(QLabel('Rendered'), 1, 1)
grid.addWidget(QLabel('Difference'), 1, 2)
grid.addWidget(self.control_label, 2, 0)
grid.addWidget(self.rendered_label, 2, 1)
grid.addWidget(self.diff_label, 2, 2)
grid.addWidget(QLabel('Current Mask'), 3, 0)
grid.addWidget(QLabel('New Mask'), 3, 1)
grid.addWidget(self.mask_label, 4, 0)
grid.addWidget(self.new_mask_label, 4, 1)
self.widget.setLayout(grid)
self.scrollArea.setWidget(self.widget)
v_layout = QVBoxLayout()
v_layout.addWidget(self.scrollArea, 1)
next_image_button = QPushButton()
next_image_button.setText('Skip')
next_image_button.pressed.connect(self.load_next)
self.overload_spin = QDoubleSpinBox()
self.overload_spin.setMinimum(1)
self.overload_spin.setMaximum(255)
self.overload_spin.setValue(1)
self.overload_spin.valueChanged.connect(lambda: save_mask_button.setEnabled(False))
preview_mask_button = QPushButton()
preview_mask_button.setText('Preview New Mask')
preview_mask_button.pressed.connect(self.preview_mask)
preview_mask_button.pressed.connect(lambda: save_mask_button.setEnabled(True))
save_mask_button = QPushButton()
save_mask_button.setText('Save New Mask')
save_mask_button.pressed.connect(self.save_mask)
button_layout = QHBoxLayout()
button_layout.addWidget(next_image_button)
button_layout.addWidget(QLabel('Mask diff multiplier:'))
button_layout.addWidget(self.overload_spin)
button_layout.addWidget(preview_mask_button)
button_layout.addWidget(save_mask_button)
button_layout.addStretch()
v_layout.addLayout(button_layout)
self.setLayout(v_layout)
示例3: __init__
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addLayout [as 别名]
def __init__(self, parent=None):
super().__init__(parent)
self.setSubTitle(self.tr("<h2>Select Menu Style</h2>"))
texts = [
self.tr("<p>Application Menu is the default for KaOS because of its \
extremely lightweight (and fast) structure.</p>"),
self.tr("<p>Application Launcher is the standard for KDE. \
Application shortcuts are arranged under a tab structure.</p>"),
self.tr("<p>Application Panel is a full screen menu style. \
Application shortcuts are arranged so that you can access them quickly and easily.</p>")
]
self.menus = [[":/data/images/menu-kicker.png", texts[0]],
[":/data/images/menu-kickoff.png", texts[1]],
[":/data/images/menu-kimpanel.png", texts[2]]]
vlayout = QVBoxLayout(self)
labelLayout = QHBoxLayout()
iconLabel = QLabel()
iconLabel.setMaximumSize(64, 64)
iconLabel.setPixmap(QIcon.fromTheme("kde").pixmap(64, 64))
labelLayout.addWidget(iconLabel)
label = QLabel(self)
label.setText(self.tr("<p>You can also customize your <strong>KDE menu</strong> as you like. \
Please choose one from the following styles.</p>"))
labelLayout.addWidget(label)
vlayout.addLayout(labelLayout)
vlayout.addItem(QSpacerItem(20, 40, QSizePolicy.Preferred, QSizePolicy.Preferred))
self.comboBox = QComboBox(self)
self.comboBox.addItem(self.tr("Application Menu"))
self.comboBox.addItem(self.tr("Application Launcher"))
self.comboBox.addItem(self.tr("Application Dashboard"))
vlayout.addWidget(self.comboBox)
vlayout.addItem(QSpacerItem(20, 40, QSizePolicy.Preferred, QSizePolicy.Preferred))
hlayout = QHBoxLayout(self)
self.labelMenu = QLabel(self)
self.labelMenu.setPixmap(QPixmap(self.menus[0][0]))
self.labelMenu.setMaximumSize(350 ,214)
hlayout.addWidget(self.labelMenu)
self.labelText = QLabel(self)
self.labelText.setWordWrap(True)
self.labelText.setText(self.tr(self.menus[0][1]))
hlayout.addWidget(self.labelText)
vlayout.addLayout(hlayout)
vlayout.addItem(QSpacerItem(20, 40, QSizePolicy.Preferred, QSizePolicy.Preferred))
self.comboBox.currentIndexChanged.connect(self.menuSelect)
self.menuSelected = 0
示例4: __init__
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addLayout [as 别名]
def __init__(self, parent):
super(CharacterDialog, self).__init__(parent)
self.setWindowTitle(_("KeepKey Seed Recovery"))
self.character_pos = 0
self.word_pos = 0
self.loop = QEventLoop()
self.word_help = QLabel()
self.char_buttons = []
vbox = QVBoxLayout(self)
vbox.addWidget(WWLabel(CHARACTER_RECOVERY))
hbox = QHBoxLayout()
hbox.addWidget(self.word_help)
for i in range(4):
char_button = CharacterButton('*')
char_button.setMaximumWidth(36)
self.char_buttons.append(char_button)
hbox.addWidget(char_button)
self.accept_button = CharacterButton(_("Accept Word"))
self.accept_button.clicked.connect(partial(self.process_key, 32))
self.rejected.connect(partial(self.loop.exit, 1))
hbox.addWidget(self.accept_button)
hbox.addStretch(1)
vbox.addLayout(hbox)
self.finished_button = QPushButton(_("Seed Entered"))
self.cancel_button = QPushButton(_("Cancel"))
self.finished_button.clicked.connect(partial(self.process_key,
Qt.Key_Return))
self.cancel_button.clicked.connect(self.rejected)
buttons = Buttons(self.finished_button, self.cancel_button)
vbox.addSpacing(40)
vbox.addLayout(buttons)
self.refresh()
self.show()
示例5: export_history_dialog
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addLayout [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."))
示例6: show_info_dialog
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addLayout [as 别名]
def show_info_dialog( caption, parent, initial_text ):
dialog = QDialog( parent )
dialog.setWindowTitle( caption )
# Create OK and Cancel buttons in a horizontal box.
ok_button = QPushButton("OK")
ok_button.setDefault(True)
ok_button.clicked.connect(dialog.accept)
cancel_button = QPushButton("Cancel")
cancel_button.setDefault(False)
cancel_button.clicked.connect(dialog.reject)
hbox = QHBoxLayout()
hbox.addWidget(cancel_button,0)
hbox.addStretch()
hbox.addWidget(ok_button,0)
# Lay out a Plain Text Edit above the buttons.
vbox = QVBoxLayout()
pt_editor = QPlainTextEdit()
pt_editor.document().setPlainText( initial_text )
vbox.addWidget(pt_editor,1)
vbox.addLayout(hbox,0)
dialog.setLayout(vbox)
result = dialog.exec_()
if result :
return pt_editor.document().toPlainText()
else :
return None
示例7: widgetImage
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addLayout [as 别名]
def widgetImage(self):
"""Create main image display.
"""
imageArea = QHBoxLayout()
scroll = QScrollArea()
scroll.setAlignment(QtCore.Qt.AlignCenter)
self.imageLabel = QLabel(self)
scroll.setWidget(self.imageLabel)
next = QPushButton(self.tr('>'))
next.clicked.connect(self.nextCluster)
prev = QPushButton(self.tr('<'))
prev.clicked.connect(self.prevCluster)
imageArea.addWidget(prev)
imageArea.addWidget(scroll)
imageArea.addWidget(next)
vbox = QVBoxLayout()
self.clusterCountLabel = QLabel(self)
self.clusterCountLabel.setAlignment(QtCore.Qt.AlignCenter)
f = QtGui.QFont('Arial', 14, QtGui.QFont.Bold);
self.clusterCountLabel.setFont(f)
vbox.addWidget(self.clusterCountLabel)
vbox.addLayout(imageArea)
return vbox
示例8: _get_control_layout
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addLayout [as 别名]
def _get_control_layout(self):
"""
Create static layout.
"""
widget = QWidget()
vbox = QVBoxLayout()
widget.setLayout(vbox)
vbox.setContentsMargins(0, 0, 0, 0)
self.template_combo_box = QComboBox()
self.template_combo_box.currentIndexChanged.connect(self._item_selected)
vbox.addWidget(self.template_combo_box)
scrollable_vbox = utils.get_scrollable(self.controls_layout)
vbox.addWidget(scrollable_vbox, stretch=80)
buttons_layout = QHBoxLayout()
vbox.addLayout(buttons_layout, stretch=20)
b = QPushButton("Назад")
b.setObjectName("controls")
b.clicked.connect(self._close)
buttons_layout.addWidget(b)
widget.setGraphicsEffect(utils.get_shadow())
return widget
示例9: initialize
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addLayout [as 别名]
def initialize(self):
tab_widget = QTabWidget()
tab1 = QWidget()
tab2 = QWidget()
juggle_button = QPushButton("Juggle")
juggle_button.clicked.connect(self.start_simulation)
hbox = QHBoxLayout()
hbox.addStretch(1)
hbox.addWidget(juggle_button)
vbox = QVBoxLayout(tab1)
vbox.addStretch(1)
vbox.addLayout(hbox)
hbox2 = QHBoxLayout(tab2)
tab_widget.addTab(tab1, "Main")
tab_widget.addTab(tab2, "Other")
self.setCentralWidget(tab_widget)
menubar = self.menuBar()
file_menu = menubar.addMenu('&File')
help_menu = menubar.addMenu('&Help')
about = help_menu.addMenu('&About')
exit_action = QAction(QIcon('exit.png'), '&Exit', self)
exit_action.triggered.connect(qApp.quit)
file_menu.addAction(exit_action)
self.setGeometry(300, 300, 350, 300)
self.setWindowTitle('Juggling Simulator')
self.show()
示例10: __init__
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addLayout [as 别名]
def __init__(self, parent, node):
super(FileServerWidget, self).__init__(parent)
self.setTitle('File server (uavcan.protocol.file.*)')
self._node = node
self._file_server = None
self._path_widgets = []
self._start_button = make_icon_button('rocket', 'Launch/stop the file server', self,
checkable=True,
on_clicked=self._on_start_stop)
self._start_button.setEnabled(False)
self._tmr = QTimer(self)
self._tmr.setSingleShot(False)
self._tmr.timeout.connect(self._update_on_timer)
self._tmr.start(500)
self._add_path_button = \
make_icon_button('plus', 'Add lookup path (lookup paths can be modified while the server is running)',
self, on_clicked=self._on_add_path)
layout = QVBoxLayout(self)
controls_layout = QHBoxLayout(self)
controls_layout.addWidget(self._start_button)
controls_layout.addWidget(self._add_path_button)
controls_layout.addStretch(1)
layout.addLayout(controls_layout)
self.setLayout(layout)
示例11: __init__
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addLayout [as 别名]
def __init__(self, parent=None):
super().__init__(parent)
self.setSubTitle(self.tr("<h2>Setup Mouse Behavior</h2>"))
vlayout = QVBoxLayout(self)
labelLayout = QHBoxLayout()
imageLabel = QLabel()
imageLabel.setPixmap(QPixmap(":/data/images/preferences-desktop-peripherals.png"))
imageLabel.setMaximumSize(64, 64)
labelLayout.addWidget(imageLabel)
mouseLabel = QLabel(self)
mouseLabel.setText(self.tr("""<p>The <strong>clicking behavior</strong> defines how many times you want
to click when you are opening a file. If you are <strong>left handed</strong>, you may prefer to
swap the left and right buttons of your pointing device.</p>"""))
mouseLabel.setWordWrap(True)
labelLayout.addWidget(mouseLabel)
vlayout.addLayout(labelLayout)
vlayout.addItem(QSpacerItem(20, 100, QSizePolicy.Preferred, QSizePolicy.Preferred))
hlayout = QHBoxLayout()
vlayout.addLayout(hlayout)
self.createGroupBox(hlayout)
vlayout.addItem(QSpacerItem(20, 40, QSizePolicy.Preferred, QSizePolicy.Preferred))
self.folderSingleClick = False
self.mouseButtonMap = "RightHanded"
self.reverseScrollPolarity = False
示例12: __init__
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addLayout [as 别名]
def __init__(self, parent=None):
super(ConfigurationPage, self).__init__(parent)
configGroup = QGroupBox("Server configuration")
serverLabel = QLabel("Server:")
serverCombo = QComboBox()
serverCombo.addItem("Trolltech (Australia)")
serverCombo.addItem("Trolltech (Germany)")
serverCombo.addItem("Trolltech (Norway)")
serverCombo.addItem("Trolltech (People's Republic of China)")
serverCombo.addItem("Trolltech (USA)")
serverLayout = QHBoxLayout()
serverLayout.addWidget(serverLabel)
serverLayout.addWidget(serverCombo)
configLayout = QVBoxLayout()
configLayout.addLayout(serverLayout)
configGroup.setLayout(configLayout)
mainLayout = QVBoxLayout()
mainLayout.addWidget(configGroup)
mainLayout.addStretch(1)
self.setLayout(mainLayout)
示例13: init_ui
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addLayout [as 别名]
def init_ui(self):
path = os.getcwd()
url = path + HTM_FILE
self.webView.setUrl(QtCore.QUrl(url))
self.webView.page().loadFinished.connect(self.load_finished) # for test
self.inputText.setEnabled(False)
self.inputText.setAcceptRichText(False)
self.inputText.setToolTip("每行一组经纬度,纬度lat在前\n" + "以空格、逗号或制表符分隔")
self.runButton.clicked.connect(self.add_points) # show all points in input text window
self.clrButton.clicked.connect(self.clr_points)
buttonBox = QHBoxLayout() # button box
buttonBox.addStretch()
buttonBox.addWidget(self.runButton)
buttonBox.addWidget(self.clrButton)
rightBox = QVBoxLayout() # right box
rightBox.addWidget(self.sourceType)
rightBox.addWidget(self.inputText)
rightBox.addLayout(buttonBox)
rightBox.addWidget(self.statusBar)
layout = QHBoxLayout() # main box
layout.addWidget(self.webView)
layout.addLayout(rightBox)
self.setLayout(layout)
self.setWindowTitle('经纬度地图显示')
self.show()
示例14: __init__
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addLayout [as 别名]
def __init__(self, page):
super(LogTool, self).__init__(page)
layout = QVBoxLayout()
self.setLayout(layout)
self.fontLabel = QLabel()
self.fontChooser = QFontComboBox(currentFontChanged=self.changed)
self.fontSize = QDoubleSpinBox(valueChanged=self.changed)
self.fontSize.setRange(6.0, 32.0)
self.fontSize.setSingleStep(0.5)
self.fontSize.setDecimals(1)
box = QHBoxLayout()
box.addWidget(self.fontLabel)
box.addWidget(self.fontChooser, 1)
box.addWidget(self.fontSize)
layout.addLayout(box)
self.showlog = QCheckBox(toggled=self.changed)
layout.addWidget(self.showlog)
self.rawview = QCheckBox(toggled=self.changed)
layout.addWidget(self.rawview)
self.hideauto = QCheckBox(toggled=self.changed)
layout.addWidget(self.hideauto)
app.translateUI(self)
示例15: changeTileWidth
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addLayout [as 别名]
def changeTileWidth():
"""Change tile width (tile block size) and reset image-scene"""
dlg = QDialog(self)
dlg.setWindowTitle("Viewer Tile Width")
dlg.setModal(True)
spinBox = QSpinBox(parent=dlg)
spinBox.setRange(128, 10 * 1024)
spinBox.setValue(self.editor.imageScenes[0].tileWidth())
ctrl_layout = QHBoxLayout()
ctrl_layout.addSpacerItem(QSpacerItem(10, 0, QSizePolicy.Expanding))
ctrl_layout.addWidget(QLabel("Tile Width:"))
ctrl_layout.addWidget(spinBox)
button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, parent=dlg)
button_box.accepted.connect(dlg.accept)
button_box.rejected.connect(dlg.reject)
dlg_layout = QVBoxLayout()
dlg_layout.addLayout(ctrl_layout)
dlg_layout.addWidget(
QLabel("Setting will apply current view immediately,\n" "and all other views upon restart.")
)
dlg_layout.addWidget(button_box)
dlg.setLayout(dlg_layout)
if dlg.exec_() == QDialog.Accepted:
for s in self.editor.imageScenes:
if s.tileWidth != spinBox.value():
s.setTileWidth(spinBox.value())
s.reset()