我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PyQt5.QtWidgets.QGridLayout()。
def setupUi(self, TabWidget): TabWidget.setObjectName("TabWidget") TabWidget.resize(721, 659) self.tab_Contributors = QtWidgets.QWidget() self.tab_Contributors.setObjectName("tab_Contributors") self.gridLayout_2 = QtWidgets.QGridLayout(self.tab_Contributors) self.gridLayout_2.setObjectName("gridLayout_2") self.textBrowser_Contributors = QtWidgets.QTextBrowser(self.tab_Contributors) self.textBrowser_Contributors.setObjectName("textBrowser_Contributors") self.gridLayout_2.addWidget(self.textBrowser_Contributors, 0, 0, 1, 1) TabWidget.addTab(self.tab_Contributors, "") self.tab_License = QtWidgets.QWidget() self.tab_License.setObjectName("tab_License") self.gridLayout = QtWidgets.QGridLayout(self.tab_License) self.gridLayout.setObjectName("gridLayout") self.textBrowser_License = QtWidgets.QTextBrowser(self.tab_License) self.textBrowser_License.setObjectName("textBrowser_License") self.gridLayout.addWidget(self.textBrowser_License, 0, 0, 1, 1) TabWidget.addTab(self.tab_License, "") self.retranslateUi(TabWidget) TabWidget.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(TabWidget)
def __init__(self, parent=None): super(AddressBook, self).__init__(parent) nameLabel = QLabel("Name:") self.nameLine = QLineEdit() addressLabel = QLabel("Address:") self.addressText = QTextEdit() mainLayout = QGridLayout() mainLayout.addWidget(nameLabel, 0, 0) mainLayout.addWidget(self.nameLine, 0, 1) mainLayout.addWidget(addressLabel, 1, 0, Qt.AlignTop) mainLayout.addWidget(self.addressText, 1, 1) self.setLayout(mainLayout) self.setWindowTitle("Simple Address Book")
def __init__(self, ebeveyn=None): super(Son, self).__init__(ebeveyn) self.e = ebeveyn self.kapanacak_mi =False kutu = QGridLayout() self.setLayout(kutu) milis_logo = QLabel() milis_logo.setAlignment(Qt.AlignCenter) milis_logo.setPixmap(QPixmap("./resimler/milis-logo.svg")) kutu.addWidget(milis_logo,0,0,1,2) self.veda_label = QLabel() self.veda_label.setAlignment(Qt.AlignCenter) self.veda_label.setWordWrap(True) kutu.addWidget(self.veda_label,1,0,1,2) self.denemeye_devam = QRadioButton() self.denemeye_devam.setIcon(QIcon("./resimler/cik.svg")) self.denemeye_devam.setIconSize(QSize(50,50)) self.denemeye_devam.toggled.connect(self.degisti) kutu.addWidget(self.denemeye_devam,2,0,1,1) self.kapat = QRadioButton() self.kapat.setIcon(QIcon("./resimler/yeniden-baslat.svg")) self.kapat.setIconSize(QSize(50,50)) self.kapat.toggled.connect(self.degisti) kutu.addWidget(self.kapat,2,1,1,1) self.denemeye_devam.setChecked(True)
def setupUi(self, Form): Form.setObjectName("Form") self.gridLayout = QtWidgets.QGridLayout(Form) self.gridLayout.setObjectName("gridLayout") self.chooseDataLabel = QtWidgets.QLabel(Form) self.chooseDataLabel.setObjectName("chooseDataLabel") self.gridLayout.addWidget(self.chooseDataLabel, 0, 0, 1, 1) self.chooseDataComboBox = QtWidgets.QComboBox(Form) self.chooseDataComboBox.setObjectName("chooseDataComboBox") self.gridLayout.addWidget(self.chooseDataComboBox, 0, 1, 1, 1) self.refreshTablePushButton = QtWidgets.QPushButton(Form) self.refreshTablePushButton.setObjectName("refreshTablePushButton") self.gridLayout.addWidget(self.refreshTablePushButton, 2, 1, 1, 1) self.tableView = QtWidgets.QTableView(Form) self.tableView.setObjectName("tableView") self.gridLayout.addWidget(self.tableView, 4, 0, 1, 2) self.refreshDataPushButton = QtWidgets.QPushButton(Form) self.refreshDataPushButton.setObjectName("refreshDataPushButton") self.gridLayout.addWidget(self.refreshDataPushButton, 1, 1, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, FileInfoDialog): FileInfoDialog.setObjectName("FileInfoDialog") FileInfoDialog.resize(579, 472) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("icons/157-stats-bars.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) FileInfoDialog.setWindowIcon(icon) self.gridLayout = QtWidgets.QGridLayout(FileInfoDialog) self.gridLayout.setObjectName("gridLayout") self.gridLayout_2 = QtWidgets.QGridLayout() self.gridLayout_2.setObjectName("gridLayout_2") self.tabWidget = QtWidgets.QTabWidget(FileInfoDialog) self.tabWidget.setObjectName("tabWidget") self.gridLayout_2.addWidget(self.tabWidget, 0, 0, 1, 1) self.buttonBox = QtWidgets.QDialogButtonBox(FileInfoDialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close) self.buttonBox.setObjectName("buttonBox") self.gridLayout_2.addWidget(self.buttonBox, 1, 0, 1, 1) self.gridLayout.addLayout(self.gridLayout_2, 0, 0, 1, 1) self.retranslateUi(FileInfoDialog) self.tabWidget.setCurrentIndex(-1) self.buttonBox.accepted.connect(FileInfoDialog.accept) self.buttonBox.rejected.connect(FileInfoDialog.reject) QtCore.QMetaObject.connectSlotsByName(FileInfoDialog)
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(540, 393) self.gridLayout = QtWidgets.QGridLayout(Dialog) self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(Dialog) self.label.setText("") self.label.setPixmap(QtGui.QPixmap(":/newPrefix/images/image3487.png")) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.textBrowser = QtWidgets.QTextBrowser(Dialog) font = QtGui.QFont() font.setFamily("Arial") self.textBrowser.setFont(font) self.textBrowser.setOpenExternalLinks(True) self.textBrowser.setObjectName("textBrowser") self.gridLayout.addWidget(self.textBrowser, 1, 0, 1, 1) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
def __init__(self, cpu_histogram): super().__init__() # set up the graphical elements layout = QGridLayout(self) self.setLayout(layout) fig = Figure() layout.addWidget(FigureCanvas(fig)) # do the plotting ax = fig.add_subplot(1, 1, 1) # 1x1 grid, first subplot ax.set_title('CPU Usage Histogram (%s Cores/%s Threads)' % (psutil.cpu_count(False), psutil.cpu_count(True))) ax.set_ylabel('Count') ax.set_xlabel('CPU %') ax.grid(True) xs = range(0, 101) ax.plot(xs, [cpu_histogram[x] for x in xs]) ax.xaxis.set_major_locator(MultipleLocator(10.)) self.show()
def setupUi(self, Log): Log.setObjectName("Log") Log.resize(631, 264) self.gridLayout = QtWidgets.QGridLayout(Log) self.gridLayout.setObjectName("gridLayout") self.buttonBox = QtWidgets.QDialogButtonBox(Log) self.buttonBox.setOrientation(QtCore.Qt.Vertical) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.gridLayout.addWidget(self.buttonBox, 0, 1, 1, 1) self.plainTextEdit = QtWidgets.QPlainTextEdit(Log) self.plainTextEdit.setLineWrapMode(QtWidgets.QPlainTextEdit.NoWrap) self.plainTextEdit.setObjectName("plainTextEdit") self.gridLayout.addWidget(self.plainTextEdit, 0, 0, 1, 1) self.retranslateUi(Log) self.buttonBox.accepted.connect(Log.accept) self.buttonBox.rejected.connect(Log.reject) QtCore.QMetaObject.connectSlotsByName(Log)
def setupUi(self, Help): Help.setObjectName("Help") Help.resize(456, 582) self.gridLayout = QtWidgets.QGridLayout(Help) self.gridLayout.setObjectName("gridLayout") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.textBrowser = QtWidgets.QTextBrowser(Help) self.textBrowser.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) self.textBrowser.setOpenExternalLinks(True) self.textBrowser.setObjectName("textBrowser") self.verticalLayout.addWidget(self.textBrowser) self.buttonBox = QtWidgets.QDialogButtonBox(Help) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.verticalLayout.addWidget(self.buttonBox) self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1) self.retranslateUi(Help) QtCore.QMetaObject.connectSlotsByName(Help)
def add_classes_frame(self): self.vbox.setStretch(self.vbox.count()-1, 0) hbox = QtWidgets.QHBoxLayout() self.vbox.addLayout(hbox) self.class_line = QtWidgets.QGridLayout() hbox.addLayout(self.class_line) hbox.addStretch(1) self.class_num = QtWidgets.QButtonGroup() self.refresh_classes() hbox = QtWidgets.QHBoxLayout() self.vbox.addLayout(hbox) button = QtWidgets.QPushButton('Show', self) button.clicked.connect(self.show_selected_class) hbox.addWidget(button) button = QtWidgets.QPushButton('See all', self) button.clicked.connect(self.show_all_classes) hbox.addWidget(button) button = QtWidgets.QPushButton('Refresh', self) button.clicked.connect(self.refresh_classes) hbox.addWidget(button) hbox.addStretch(1) self.vbox.addStretch(1)
def __init__(self, addons, parent): super().__init__() self.setGeometry(300, 300, 300, 300) self.setWindowTitle('Open Addon') self.setWindowIcon(QIcon(ICON_PATH)) label = QLabel('Choose the addon you want to open.') grid = QGridLayout() grid.setSpacing(4) grid.addWidget(label, 0, 0) self.addonList = addons.split('-') self.addonList.remove('') self.parent = parent for i,j in enumerate(self.addonList): l = QLabel(str(i)+' -> '+j) grid.addWidget(l, i+1, 0) self.setLayout(grid) self.show()
def createGridLayout(self): self.horizontalGroupBox = QGroupBox("Grid") layout = QGridLayout() layout.setColumnStretch(1, 4) layout.setColumnStretch(2, 4) layout.addWidget(QPushButton('1'),0,0) layout.addWidget(QPushButton('2'),0,1) layout.addWidget(QPushButton('3'),0,2) layout.addWidget(QPushButton('4'),1,0) layout.addWidget(QPushButton('5'),1,1) layout.addWidget(QPushButton('6'),1,2) layout.addWidget(QPushButton('7'),2,0) layout.addWidget(QPushButton('8'),2,1) layout.addWidget(QPushButton('9'),2,2) self.horizontalGroupBox.setLayout(layout)
def setupUi(self, TabTextual): TabTextual.setObjectName("TabTextual") TabTextual.resize(400, 300) self.gridLayout = QtWidgets.QGridLayout(TabTextual) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setHorizontalSpacing(0) self.gridLayout.setVerticalSpacing(4) self.gridLayout.setObjectName("gridLayout") self.textConfigEdit = TextConfigEditor(TabTextual) self.textConfigEdit.setObjectName("textConfigEdit") self.gridLayout.addWidget(self.textConfigEdit, 0, 0, 1, 1) self.correctness_label = QtWidgets.QLabel(TabTextual) self.correctness_label.setAlignment(QtCore.Qt.AlignCenter) self.correctness_label.setWordWrap(True) self.correctness_label.setObjectName("correctness_label") self.gridLayout.addWidget(self.correctness_label, 1, 0, 1, 1) self.retranslateUi(TabTextual) QtCore.QMetaObject.connectSlotsByName(TabTextual)
def __init__(self, ebeveyn=None): super(Konum, self).__init__(ebeveyn) self.e = ebeveyn kutu = QGridLayout() kutu.setAlignment(Qt.AlignCenter) self.setLayout(kutu) self.bigli_label = QLabel() kutu.addWidget(self.bigli_label,0,0,1,2) self.harita = HaritaWidget(self) kutu.addWidget(self.harita,1,0,1,2) self.bolge_label = QLabel() kutu.addWidget(self.bolge_label,2,0,1,1) self.sehir_label = QLabel() kutu.addWidget(self.sehir_label,2,1,1,1) self.bolge_combo = QComboBox() self.bolge_combo.currentTextChanged.connect(self.sehir_combo_doldur) kutu.addWidget(self.bolge_combo,3,0,1,1) self.sehir_combo = QComboBox() self.sehir_combo.currentTextChanged.connect(self.sehir_combo_degisti) kutu.addWidget(self.sehir_combo,3,1,1,1) self.bolge_combo_doldur() self.bolge_combo.setCurrentText("Europe") self.sehir_combo.setCurrentText("Istanbul")
def __init__(self, parent, slider: VideoSlider): super(VideoSliderWidget, self).__init__(parent) self.parent = parent self.slider = slider self.loaderEffect = OpacityEffect() self.loaderEffect.setEnabled(False) self.setGraphicsEffect(self.loaderEffect) self.setContentsMargins(0, 0, 0, 0) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.layout().setStackingMode(QStackedLayout.StackAll) self.genlabel = QLabel(self.parent) self.genlabel.setContentsMargins(0, 0, 0, 14) self.genlabel.setPixmap(QPixmap(':/images/generating-thumbs.png')) self.genlabel.setAlignment(Qt.AlignCenter) self.genlabel.hide() sliderLayout = QGridLayout() sliderLayout.setContentsMargins(0, 0, 0, 0) sliderLayout.setSpacing(0) sliderLayout.addWidget(self.slider, 0, 0) sliderLayout.addWidget(self.genlabel, 0, 0) sliderWidget = QWidget(self.parent) sliderWidget.setLayout(sliderLayout) self.addWidget(sliderWidget)
def setupUi(self, DlgAbout): DlgAbout.setObjectName("DlgAbout") DlgAbout.resize(382, 372) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(DlgAbout.sizePolicy().hasHeightForWidth()) DlgAbout.setSizePolicy(sizePolicy) self.gridLayout = QtWidgets.QGridLayout(DlgAbout) self.gridLayout.setObjectName("gridLayout") self.btnClose = QtWidgets.QPushButton(DlgAbout) self.btnClose.setMinimumSize(QtCore.QSize(80, 0)) self.btnClose.setObjectName("btnClose") self.gridLayout.addWidget(self.btnClose, 1, 0, 1, 1, QtCore.Qt.AlignRight) self.txtAbout = QtWidgets.QTextBrowser(DlgAbout) self.txtAbout.setMinimumSize(QtCore.QSize(350, 240)) self.txtAbout.setOpenExternalLinks(True) self.txtAbout.setObjectName("txtAbout") self.gridLayout.addWidget(self.txtAbout, 0, 0, 1, 1) self.retranslateUi(DlgAbout) self.btnClose.clicked.connect(DlgAbout.reject) QtCore.QMetaObject.connectSlotsByName(DlgAbout)
def __init__(self): super().__init__() self.layout = QtWidgets.QGridLayout() self.setStyleSheet("QPushButton{margin:0.5em 0 0 0;padding:0.25em 1em}") self.username_label = QtWidgets.QLabel("Nom d'utilisateur:", self) self.password_label = QtWidgets.QLabel("Mot de passe:", self) self.username_input = QtWidgets.QLineEdit(self) self.password_input = QtWidgets.QLineEdit(self) self.password_input.setEchoMode(QtWidgets.QLineEdit.Password) self.cancel_button = QtWidgets.QPushButton("Annuler", self) self.validation_button = QtWidgets.QPushButton("Ajouter", self) self.layout.addWidget(self.username_label, 0, 0) self.layout.addWidget(self.username_input, 1, 0, 1, 0) self.layout.addWidget(self.password_label, 2, 0) self.layout.addWidget(self.password_input, 3, 0, 1, 0) self.layout.addWidget(self.validation_button, 4, 0) self.layout.addWidget(self.cancel_button, 4, 1) self.cancel_button.setAutoDefault(False) self.setLayout(self.layout) self.cancel_button.clicked.connect(self.reject) self.validation_button.clicked.connect(self.accept)
def setupUi(self, chatBox,message): chatBox.setObjectName("chatBox") chatBox.resize(473, 294) self.gridLayout = QtWidgets.QGridLayout(chatBox) self.gridLayout.setObjectName("gridLayout") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.chatLabel = QtWidgets.QLabel(chatBox) self.chatLabel.setObjectName("chatLabel") self.verticalLayout.addWidget(self.chatLabel) self.userChat = chatText(chatBox) self.userChat.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) self.userChat.setObjectName("userChat") self.verticalLayout.addWidget(self.userChat) self.gridLayout.addLayout(self.verticalLayout, 1, 0, 4, 1) self.chat = QtWidgets.QTextEdit(chatBox) self.chat.setEnabled(True) self.chat.setReadOnly(True) self.chat.setObjectName("chat") self.gridLayout.addWidget(self.chat, 0, 0, 1, 2) self.listOnline = QtWidgets.QPushButton(chatBox) self.listOnline.setObjectName("listOnline") self.gridLayout.addWidget(self.listOnline, 1, 1, 1, 1) self.sendButton = QtWidgets.QPushButton(chatBox) self.sendButton.setObjectName("sendButton") self.gridLayout.addWidget(self.sendButton, 3, 1, 1, 1) self.exitButton = QtWidgets.QPushButton(chatBox) self.exitButton.setObjectName("exitButton") self.gridLayout.addWidget(self.exitButton, 4, 1, 1, 1) self.fileSendButton = QtWidgets.QPushButton(chatBox) self.fileSendButton.setObjectName("fileSendButton") self.gridLayout.addWidget(self.fileSendButton, 2, 1, 1, 1) self.retranslateUi(chatBox,message) QtCore.QMetaObject.connectSlotsByName(chatBox)
def setupUi(self, chatBox,message): chatBox.setObjectName("chatBox") chatBox.resize(473, 294) self.gridLayout = QtWidgets.QGridLayout(chatBox) self.gridLayout.setObjectName("gridLayout") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.chatLabel = QtWidgets.QLabel(chatBox) self.chatLabel.setObjectName("chatLabel") self.verticalLayout.addWidget(self.chatLabel) self.userChat = QtWidgets.QTextEdit(chatBox) self.userChat.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) self.userChat.setObjectName("userChat") self.verticalLayout.addWidget(self.userChat) self.gridLayout.addLayout(self.verticalLayout, 1, 0, 4, 1) self.chat = QtWidgets.QTextEdit(chatBox) self.chat.setEnabled(True) self.chat.setReadOnly(True) self.chat.setObjectName("chat") self.gridLayout.addWidget(self.chat, 0, 0, 1, 2) self.listOnline = QtWidgets.QPushButton(chatBox) self.listOnline.setObjectName("listOnline") self.gridLayout.addWidget(self.listOnline, 1, 1, 1, 1) self.sendButton = QtWidgets.QPushButton(chatBox) self.sendButton.setObjectName("sendButton") self.gridLayout.addWidget(self.sendButton, 3, 1, 1, 1) self.exitButton = QtWidgets.QPushButton(chatBox) self.exitButton.setObjectName("exitButton") self.gridLayout.addWidget(self.exitButton, 4, 1, 1, 1) self.fileSendButton = QtWidgets.QPushButton(chatBox) self.fileSendButton.setObjectName("fileSendButton") self.gridLayout.addWidget(self.fileSendButton, 2, 1, 1, 1) self.retranslateUi(chatBox,message) self.exitButton.clicked.connect(chatBox.close) self.sendButton.clicked.connect(self.userChat.clear) self.fileSendButton.clicked.connect(self.userChat.clear) QtCore.QMetaObject.connectSlotsByName(chatBox)
def __init__(self, trace=None, parent=None): QtWidgets.QWidget.__init__(self, parent=parent) VQTraceNotifier.__init__(self, trace) self.grid = QtWidgets.QGridLayout() if not trace.hasStatusRegister(): return self.flags_def = trace.getStatusRegNameDesc() self.flags = {} self.flag_labels = {} for idx, (name, desc) in enumerate(self.flags_def): flag_button = QtWidgets.QPushButton(name) flag_button.clicked.connect(self.buttonClicked) flag_button.setToolTip(desc) flag_label = QtWidgets.QLabel('0', self) flag_label.setAlignment(QtCore.Qt.AlignCenter) self.flag_labels[name] = flag_label self.grid.addWidget(flag_button, 0, idx) self.grid.addWidget(flag_label, 1, idx) self.setLayout(self.grid) self.vqLoad()
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(984, 658) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.pushbutton = QtWidgets.QPushButton('Test') self.verticalLayout.addWidget(self.pushbutton) self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 984, 21)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def setup_ui(self): self.setAcceptDrops(False) self.setLayoutDirection(QtCore.Qt.LeftToRight) self.setAutoFillBackground(False) self.layout = QtWidgets.QGridLayout(self) self.textEdit = QtWidgets.QTextEdit(self) self.textEdit.setLineWrapMode(QtWidgets.QTextEdit.NoWrap) self.textEdit.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse) self.layout.addWidget(self.textEdit)
def setupUi(self, SchemaMainWindow): SchemaMainWindow.setObjectName("SchemaMainWindow") SchemaMainWindow.resize(417, 594) self.centralwidget = QtWidgets.QWidget(SchemaMainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") self.schemaLabel = QtWidgets.QLabel(self.centralwidget) self.schemaLabel.setObjectName("schemaLabel") self.gridLayout.addWidget(self.schemaLabel, 0, 0, 1, 2) self.schemaSelection = QtWidgets.QComboBox(self.centralwidget) self.schemaSelection.setObjectName("schemaSelection") self.gridLayout.addWidget(self.schemaSelection, 0, 2, 1, 2) self.schemaView = QtWidgets.QTextBrowser(self.centralwidget) self.schemaView.setObjectName("schemaView") self.gridLayout.addWidget(self.schemaView, 1, 0, 1, 4) self.instanceLabel = QtWidgets.QLabel(self.centralwidget) self.instanceLabel.setObjectName("instanceLabel") self.gridLayout.addWidget(self.instanceLabel, 2, 0, 1, 2) self.instanceSelection = QtWidgets.QComboBox(self.centralwidget) self.instanceSelection.setObjectName("instanceSelection") self.gridLayout.addWidget(self.instanceSelection, 2, 2, 1, 2) self.instanceEdit = QtWidgets.QTextEdit(self.centralwidget) self.instanceEdit.setObjectName("instanceEdit") self.gridLayout.addWidget(self.instanceEdit, 3, 0, 1, 4) self.label = QtWidgets.QLabel(self.centralwidget) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 4, 0, 1, 1) self.validationStatus = QtWidgets.QLabel(self.centralwidget) self.validationStatus.setObjectName("validationStatus") self.gridLayout.addWidget(self.validationStatus, 4, 1, 1, 2) self.validateButton = QtWidgets.QPushButton(self.centralwidget) self.validateButton.setObjectName("validateButton") self.gridLayout.addWidget(self.validateButton, 4, 3, 1, 1) SchemaMainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtWidgets.QStatusBar(SchemaMainWindow) self.statusbar.setObjectName("statusbar") SchemaMainWindow.setStatusBar(self.statusbar) self.retranslateUi(SchemaMainWindow) QtCore.QMetaObject.connectSlotsByName(SchemaMainWindow)
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(451, 322) self.gridlayout = QtWidgets.QGridLayout(Dialog) self.gridlayout.setObjectName("gridlayout") self.loadFromFileButton = QtWidgets.QPushButton(Dialog) self.loadFromFileButton.setObjectName("loadFromFileButton") self.gridlayout.addWidget(self.loadFromFileButton, 0, 0, 1, 1) self.label = QtWidgets.QLabel(Dialog) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setWordWrap(True) self.label.setObjectName("label") self.gridlayout.addWidget(self.label, 1, 0, 1, 1) self.loadFromSharedMemoryButton = QtWidgets.QPushButton(Dialog) self.loadFromSharedMemoryButton.setObjectName("loadFromSharedMemoryButton") self.gridlayout.addWidget(self.loadFromSharedMemoryButton, 2, 0, 1, 1) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
def __init__(self, parent=None): super(AddressBook, self).__init__(parent) self.contacts = SortedDict() self.oldName = '' self.oldAddress = '' nameLabel = QLabel("Name:") self.nameLine = QLineEdit() self.nameLine.setReadOnly(True) addressLabel = QLabel("Address:") self.addressText = QTextEdit() self.addressText.setReadOnly(True) self.addButton = QPushButton("&Add") self.addButton.show() self.submitButton = QPushButton("&Submit") self.submitButton.hide() self.cancelButton = QPushButton("&Cancel") self.cancelButton.hide() self.addButton.clicked.connect(self.addContact) self.submitButton.clicked.connect(self.submitContact) self.cancelButton.clicked.connect(self.cancel) buttonLayout1 = QVBoxLayout() buttonLayout1.addWidget(self.addButton, Qt.AlignTop) buttonLayout1.addWidget(self.submitButton) buttonLayout1.addWidget(self.cancelButton) buttonLayout1.addStretch() mainLayout = QGridLayout() mainLayout.addWidget(nameLabel, 0, 0) mainLayout.addWidget(self.nameLine, 0, 1) mainLayout.addWidget(addressLabel, 1, 0, Qt.AlignTop) mainLayout.addWidget(self.addressText, 1, 1) mainLayout.addLayout(buttonLayout1, 1, 2) self.setLayout(mainLayout) self.setWindowTitle("Simple Address Book")
def __init__(self, parent): super().__init__('Colors', parent) self.primary_color_button = bubblesub.ui.util.ColorPicker(self) self.secondary_color_button = bubblesub.ui.util.ColorPicker(self) self.outline_color_button = bubblesub.ui.util.ColorPicker(self) self.back_color_button = bubblesub.ui.util.ColorPicker(self) layout = QtWidgets.QGridLayout(self) layout.setColumnStretch(0, 1) layout.setColumnStretch(1, 2) layout.addWidget(QtWidgets.QLabel('Primary:', self), 0, 0) layout.addWidget(self.primary_color_button, 0, 1) layout.addWidget(QtWidgets.QLabel('Secondary:', self), 1, 0) layout.addWidget(self.secondary_color_button, 1, 1) layout.addWidget(QtWidgets.QLabel('Outline:', self), 2, 0) layout.addWidget(self.outline_color_button, 2, 1) layout.addWidget(QtWidgets.QLabel('Shadow:', self), 3, 0) layout.addWidget(self.back_color_button, 3, 1)
def __init__(self, parent): super().__init__('Transformations', parent) self.scale_x_edit = QtWidgets.QDoubleSpinBox( self, minimum=0, maximum=999) self.scale_y_edit = QtWidgets.QDoubleSpinBox( self, minimum=0, maximum=999) self.angle_edit = QtWidgets.QDoubleSpinBox( self, minimum=0, maximum=999) self.spacing_edit = QtWidgets.QDoubleSpinBox( self, minimum=0, maximum=999) layout = QtWidgets.QGridLayout(self) layout.setColumnStretch(0, 1) layout.setColumnStretch(1, 2) layout.addWidget(QtWidgets.QLabel('Scale X:', self), 0, 0) layout.addWidget(self.scale_x_edit, 0, 1) layout.addWidget(QtWidgets.QLabel('Scale Y:', self), 1, 0) layout.addWidget(self.scale_y_edit, 1, 1) layout.addWidget(QtWidgets.QLabel('Angle:', self), 2, 0) layout.addWidget(self.angle_edit, 2, 1) layout.addWidget(QtWidgets.QLabel('Spacing:', self), 3, 0) layout.addWidget(self.spacing_edit, 3, 1)
def __init__(self, courseList, socket, parent=None): QtWidgets.QDialog.__init__(self, parent) self.ui = uic.loadUi(config.config.ROOT_PATH +'view/adminSelectCourse.ui', self) self.sock = socket self.courseList = [] self.courseList = self.courseList + courseList self.register = object self.dataPos = -1 pListWidget = QtWidgets.QWidget() self.ui.scrollArea.setWidgetResizable(True) self.ui.scrollArea.setWidget(pListWidget) self.pListLayout = QtWidgets.QGridLayout() self.pListLayout.setAlignment(Qt.AlignTop) pListWidget.setLayout(self.pListLayout) self.makeCourseLayout()
def setupUi(self, Form): Form.setObjectName("Form") self.verticalLayout = QtWidgets.QVBoxLayout(Form) self.verticalLayout.setObjectName("verticalLayout") self.groupBox = QtWidgets.QGroupBox(Form) self.groupBox.setObjectName("groupBox") self.gridLayout = QtWidgets.QGridLayout(self.groupBox) self.gridLayout.setObjectName("gridLayout") self.renameDataLabel = QtWidgets.QLabel(self.groupBox) self.renameDataLabel.setObjectName("renameDataLabel") self.gridLayout.addWidget(self.renameDataLabel, 0, 0, 1, 1) self.renameDataComboBox = QtWidgets.QComboBox(self.groupBox) self.renameDataComboBox.setObjectName("renameDataComboBox") self.gridLayout.addWidget(self.renameDataComboBox, 0, 1, 1, 1) self.toDataLabel = QtWidgets.QLabel(self.groupBox) self.toDataLabel.setObjectName("toDataLabel") self.gridLayout.addWidget(self.toDataLabel, 0, 2, 1, 1) self.toDataLineEdit = QtWidgets.QLineEdit(self.groupBox) self.toDataLineEdit.setObjectName("toDataLineEdit") self.gridLayout.addWidget(self.toDataLineEdit, 0, 3, 1, 1) self.verticalLayout.addWidget(self.groupBox) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, go2mapillaryDockWidgetBase): go2mapillaryDockWidgetBase.setObjectName(_fromUtf8("go2mapillaryDockWidgetBase")) go2mapillaryDockWidgetBase.resize(320, 260) self.dockWidgetContents = QtWidgets.QWidget() sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.dockWidgetContents.sizePolicy().hasHeightForWidth()) self.dockWidgetContents.setSizePolicy(sizePolicy) self.dockWidgetContents.setMinimumSize(QtCore.QSize(320, 240)) self.dockWidgetContents.setMaximumSize(QtCore.QSize(320, 240)) self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents")) self.gridLayout = QtWidgets.QGridLayout(self.dockWidgetContents) self.gridLayout.setMargin(0) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.webView = QtWebKitWidgets.QWebView(self.dockWidgetContents) self.webView.setUrl(QtCore.QUrl(_fromUtf8("about:blank"))) self.webView.setObjectName(_fromUtf8("webView")) self.gridLayout.addWidget(self.webView, 0, 0, 1, 1) go2mapillaryDockWidgetBase.setWidget(self.dockWidgetContents) self.retranslateUi(go2mapillaryDockWidgetBase) QtCore.QMetaObject.connectSlotsByName(go2mapillaryDockWidgetBase)
def create_grid(self, grid_width, grid_height): """Create a grid layout with stacked widgets. Parameters ---------- grid_width : int the width of the grid grid_height : int the height of the grid """ self.grid_layout = QGridLayout() self.setLayout(self.grid_layout) self.grid_layout.setSpacing(1) self.grid_wgs = {} for i in xrange(grid_height): for j in xrange(grid_width): self.grid_wgs[(i, j)] = FieldWidget() self.grid_layout.addWidget(self.grid_wgs[(i, j)], i, j)
def __init__(self, parent=None): super().__init__(parent) # Create a label, push button and line edit widgets label = QtWidgets.QLabel('This is a label') run_push_button = QtWidgets.QPushButton('Click Me') line_edit = QtWidgets.QLineEdit('Default line edit text') layout = QtWidgets.QGridLayout() # add widgets layout.addWidget(label, 0, 0) layout.addWidget(line_edit, 1, 0) layout.addWidget(run_push_button, 1, 1) # create our layout, a vertical layout # layout = QtWidgets.QVBoxLayout() # add widgets # layout.addWidget(label) # layout.addWidget(line_edit) # layout.addWidget(run_push_button) # set the layout of our master widget self.setLayout(layout)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(529, 329) self.selInfoWidget = QtWidgets.QWidget(Form) self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222)) self.selInfoWidget.setObjectName("selInfoWidget") self.gridLayout = QtWidgets.QGridLayout(self.selInfoWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") self.selDescLabel = QtWidgets.QLabel(self.selInfoWidget) self.selDescLabel.setText("") self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.selDescLabel.setWordWrap(True) self.selDescLabel.setObjectName("selDescLabel") self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1) self.selNameLabel = QtWidgets.QLabel(self.selInfoWidget) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.selNameLabel.setFont(font) self.selNameLabel.setText("") self.selNameLabel.setObjectName("selNameLabel") self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1) self.selectedTree = DataTreeWidget(self.selInfoWidget) self.selectedTree.setObjectName("selectedTree") self.selectedTree.headerItem().setText(0, "1") self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2) self.hoverText = QtWidgets.QTextEdit(Form) self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81)) self.hoverText.setObjectName("hoverText") self.view = FlowchartGraphicsView(Form) self.view.setGeometry(QtCore.QRect(0, 0, 256, 192)) self.view.setObjectName("view") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(241, 367) self.gridLayout = QtWidgets.QGridLayout(Form) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(Form) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 3) self.itemTree = QtWidgets.QTreeWidget(Form) self.itemTree.setObjectName("itemTree") self.itemTree.headerItem().setText(0, "1") self.itemTree.header().setVisible(False) self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3) self.label_2 = QtWidgets.QLabel(Form) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3) self.formatList = QtWidgets.QListWidget(Form) self.formatList.setObjectName("formatList") self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3) self.exportBtn = QtWidgets.QPushButton(Form) self.exportBtn.setObjectName("exportBtn") self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1) self.closeBtn = QtWidgets.QPushButton(Form) self.closeBtn.setObjectName("closeBtn") self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1) self.paramTree = ParameterTree(Form) self.paramTree.setObjectName("paramTree") self.paramTree.headerItem().setText(0, "1") self.paramTree.header().setVisible(False) self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3) self.label_3 = QtWidgets.QLabel(Form) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3) self.copyBtn = QtWidgets.QPushButton(Form) self.copyBtn.setObjectName("copyBtn") self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def layout(self): """ """ self._main_layout = QW.QGridLayout(self)
def layout(self): """ Layout the row for this experiment. """ self._main_layout = QW.QGridLayout(self) # Construct the header for the experiment self._main_layout.addWidget(QW.QLabel(self._expt_label),0,0) # -------------- Buttons -------------------- # Button to show experiment options self._show_options_button = QW.QPushButton("", self) self._show_options_button.clicked.connect(self._options_callback) self._show_options_button.setIcon(QG.QIcon(os.path.join(self._image_base,"icons","more-info.png"))) self._show_options_button.setIconSize(QC.QSize(21,21)) self._show_options_button.setFixedWidth(30) self._main_layout.addWidget(self._show_options_button,0,1) # Button to remove experiment self._remove_button = QW.QPushButton("", self) self._remove_button.clicked.connect(self._remove_callback) self._remove_button.setIcon(QG.QIcon(os.path.join(self._image_base,"icons","delete-icon.png"))) self._remove_button.setIconSize(QC.QSize(21,21)) self._remove_button.setFixedWidth(30) self._main_layout.addWidget(self._remove_button,0,2) self.setFrameShape(QW.QFrame.StyledPanel) if self._experiment is None: self._show_options_button.setDisabled(True) self._remove_button.setDisabled(True)
def __init__(self): super().__init__() self.setLayout(QGridLayout()) self.map = MapView() self.addWidget(self.map)
def __init__(self, parent=None): super().__init__(parent) self.wizard = self.parent() self.description_label = QtWidgets.QLabel('Choose ecoinvent version and system model:') self.version_combobox = QtWidgets.QComboBox() self.system_model_combobox = QtWidgets.QComboBox() layout = QtWidgets.QGridLayout() layout.addWidget(self.description_label, 0, 0, 1, 3) layout.addWidget(QtWidgets.QLabel('Version: '), 1, 0) layout.addWidget(self.version_combobox, 1, 1, 1, 2) layout.addWidget(QtWidgets.QLabel('System model: '), 2, 0) layout.addWidget(self.system_model_combobox, 2, 1, 1, 2) self.setLayout(layout)
def about(self): about_box = QDialog() layout = QGridLayout(about_box) layout.addWidget(QLabel('hello world')) about_box.setLayout(layout) about_box.show() about_box.exec_()
def __init__(self): super().__init__() # todo: fill in parameter? self.setWindowTitle(rockthetaskbar.__application_name__) layout = QGridLayout(self) self.setLayout(layout) layout.addWidget(QLabel('RockTheTaskBar - "hello world" for a task bar MacOS/Windows app')) layout.addWidget(QLabel('Author: %s' % rockthetaskbar.__author__)) layout.addWidget(QLabel('Source: %s' % rockthetaskbar.__url__)) self.show()
def addGroup( self, label ): self.group = QtWidgets.QGroupBox( label ) self.v_layout.addWidget( self.group ) self.grid = QtWidgets.QGridLayout() self.grid.setColumnStretch( 1, 1 ) self.group.setLayout( self.grid )