我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PyQt4.QtGui.QHBoxLayout()。
def __init__ (self, title, mmax=100) : super (FamilyProgress, self).__init__ () self.setWindowTitle (title) self.setFixedHeight (48) self.pbar = QtGui.QProgressBar () self.pbar.setRange (0, mmax - 1) self.btn = QtGui.QPushButton ("Starting", self) pbarvbox = QtGui.QVBoxLayout() pbarvbox.addStretch (False) pbarvbox.addWidget (self.pbar) buttonvbox = QtGui.QVBoxLayout () buttonvbox.addStretch (True) buttonvbox.addWidget (self.btn) hbox = QtGui.QHBoxLayout () hbox.addLayout(pbarvbox, stretch=False) hbox.addLayout(buttonvbox) self.setLayout (hbox) self.pbar.setStyleSheet(START_STYLE) #self.show()
def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(867, 553) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/assets/logo.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) Form.setWindowIcon(icon) Form.setWindowOpacity(1.0) self.gridLayout = QtGui.QGridLayout(Form) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.splitter_2 = QtGui.QSplitter(Form) self.splitter_2.setOrientation(QtCore.Qt.Vertical) self.splitter_2.setObjectName(_fromUtf8("splitter_2")) self.layoutWidget = QtGui.QWidget(self.splitter_2) self.layoutWidget.setObjectName(_fromUtf8("layoutWidget")) self.idleLayout = QtGui.QHBoxLayout(self.layoutWidget) self.idleLayout.setSpacing(0) self.idleLayout.setObjectName(_fromUtf8("idleLayout")) self.gridLayout.addWidget(self.splitter_2, 0, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def initUI(self): btnWdgBar = QtGui.QWidget(self) hbox = QtGui.QHBoxLayout(btnWdgBar) okButton = QtGui.QPushButton("OK") hbox.addWidget(okButton) cancelButton = QtGui.QPushButton("Cancel") hbox.addWidget(cancelButton) #cancelButton.move(20,200) #buttonBar.addWidget(okButton) #buttonBar.addWidget(cancelButton) btnWdgBar.setLayout(hbox) self.setCentralWidget(btnWdgBar) self.statusBar().showMessage('Testing') self.setGeometry(100, 100, 800, 500) self.setWindowTitle('OpenCouture Lite') self.centerUI() self.show()
def _align(widget, checkbox=None): l = QHBoxLayout() if checkbox is not None: checkbox.setMaximumWidth(23) l.addWidget(checkbox, 0) else: l.addSpacing(25) l.addStretch(0.5) if widget is not None: widget.setMinimumWidth(180) widget.setMaximumWidth(180) l.addWidget(widget) else: l.addSpacing(180) l.setContentsMargins(0, 0, 0, 0) l.addStretch(1) w = QWidget() w.setContentsMargins(0, 2, 0, 2) w.setLayout(l) return w
def initUi(self): """?????""" self.setWindowTitle(u'??' + self.symbol + u'???') self.vbl_1 = QtGui.QVBoxLayout() self.initplotTick() # plotTick??? self.vbl_2 = QtGui.QVBoxLayout() self.initplotKline() # plotKline??? self.initplotTendency() # plot??????? # ???? self.hbl = QtGui.QHBoxLayout() self.hbl.addLayout(self.vbl_1) self.hbl.addLayout(self.vbl_2) self.setLayout(self.hbl) #self.initHistoricalData() # ??????, ?????????? ?????? self.initCompleted = True # ???????? #----------------------------------------------------------------------
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 __HorizLayout(self): """Set up Horizontal Layout. This Layout allows all widgets within scales along with the window. """ self.horizontalLayout_7 = QtGui.QHBoxLayout(self.centralWidget) # self.horizontalLayout_7.setMargin(11) self.horizontalLayout_7.setSpacing(6) self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7")) self.journalTableLayout = QtGui.QHBoxLayout() # self.journalTableLayout.setMargin(11) self.journalTableLayout.setSpacing(6) self.journalTableLayout.setObjectName(_fromUtf8("journalTableLayout")) self.__JournalList() self.journalTableLayout.addWidget(self.journalList) self.horizontalLayout_7.addLayout(self.journalTableLayout) self.entry = Entry_Widget(self) self.view = View_Widget(self) self.setLayout(self.horizontalLayout_7)
def __init__(self, parent, global_vars=None): super(MyInterpreter, self).__init__(parent) hBox = QtGui.QHBoxLayout() self.setLayout(hBox) self.textEdit = PyInterp(self, global_vars) # this is how you pass in locals to the interpreter # self.textEdit.initInterpreter(locals()) self.resize(850, 400) # self.centerOnScreen() hBox.addWidget(self.textEdit) hBox.setMargin(0) hBox.setSpacing(0) self.setWindowTitle('python shell v%s by Uncle Han' % __VERSION__) # self.show()
def __init__(self): super(MainWindow, self).__init__() self.createActions() self.createMenus() self.createToolBox() self.scene = DiagramScene(self.itemMenu) self.scene.setSceneRect(QtCore.QRectF(0, 0, 500, 400)) self.scene.itemInserted.connect(self.itemInserted) self.scene.textInserted.connect(self.textInserted) self.scene.itemSelected.connect(self.itemSelected) self.createToolbars() layout = QtGui.QHBoxLayout() layout.addWidget(self.toolBox) self.view = QtGui.QGraphicsView(self.scene) layout.addWidget(self.view) self.widget = QtGui.QWidget() self.widget.setLayout(layout) self.setCentralWidget(self.widget) self.setWindowTitle("Diagramscene")
def __init__(self, text, unit = None, minimum = None, maximum = None, parent = None): """ Initialization of the CfgSpinBox class (used for int values). @param text: text string associated with the SpinBox @param minimum: min value (int) @param minimum: max value (int) """ QWidget.__init__(self, parent) self.spinbox = QSpinBox(parent) if unit is not None: self.setUnit(unit) self.setSpec({'minimum': minimum, 'maximum': maximum, 'comment': ''}) self.label = QLabel(text, parent) self.layout = QHBoxLayout(parent); self.spinbox.setMinimumWidth(200) #Provide better alignment with other items self.layout.addWidget(self.label) self.layout.addStretch() self.layout.addWidget(self.spinbox) self.setLayout(self.layout)
def __init__(self, text, items_list = None, default_item = None, parent = None): """ Initialization of the CfgComboBox class (drop-down menu). @param text: text string associated with the combobox @param items_list: string list containing all the available options @param default_item: string containing the default selected item """ QWidget.__init__(self, parent) self.combobox = QComboBox(parent) if isinstance(items_list, (list, tuple)): self.setSpec({'string_list': items_list, 'comment': ''}) if default_item is not None: self.setValue(default_item) self.label = QLabel(text, parent) self.layout = QHBoxLayout(parent); self.combobox.setMinimumWidth(200) #Provide better alignment with other items self.layout.addWidget(self.label) self.layout.addStretch() self.layout.addWidget(self.combobox) self.setLayout(self.layout)
def initUI(self): # Layout are better for placing widgets layout = QtGui.QHBoxLayout() self.runButton = QtGui.QPushButton('Run') self.runButton.clicked.connect(self.callProgram) self.output = QtGui.QTextEdit() layout.addWidget(self.output) layout.addWidget(self.runButton) centralWidget = QtGui.QWidget() centralWidget.setLayout(layout) self.setCentralWidget(centralWidget) # QProcess object for external app self.process = QtCore.QProcess(self) # QProcess emits `readyRead` when there is data to be read self.process.readyRead.connect(self.dataReady) # Just to prevent accidentally running multiple times # Disable the button when process starts, and enable it when it finishes self.process.started.connect(lambda: self.runButton.setEnabled(False)) self.process.finished.connect(lambda: self.runButton.setEnabled(True)) #Function Main Start
def __init__(self, msg): super(YesNoDialog, self).__init__() vbox = QtGui.QVBoxLayout() vbox.addWidget(QtGui.QLabel(msg)) vbox.addStretch(1) hbox = QtGui.QHBoxLayout() hbox.addStretch(1) buttonYes = QtGui.QPushButton(Lang.value('CO_Yes'), self) buttonYes.clicked.connect(self.accept) buttonNo = QtGui.QPushButton(Lang.value('CO_No'), self) buttonNo.clicked.connect(self.reject) hbox.addWidget(buttonYes) hbox.addWidget(buttonNo) vbox.addLayout(hbox) self.setLayout(vbox)
def __init__(self, msg): super(YesNoCancelDialog, self).__init__() vbox = QtGui.QVBoxLayout() vbox.addWidget(QtGui.QLabel(msg)) vbox.addStretch(1) hbox = QtGui.QHBoxLayout() hbox.addStretch(1) buttonYes = QtGui.QPushButton(Lang.value('CO_Yes'), self) buttonYes.clicked.connect(self.yes) buttonNo = QtGui.QPushButton(Lang.value('CO_No'), self) buttonNo.clicked.connect(self.no) buttonCancel = QtGui.QPushButton(Lang.value('CO_Cancel'), self) buttonCancel.clicked.connect(self.cancel) hbox.addWidget(buttonYes) hbox.addWidget(buttonNo) hbox.addWidget(buttonCancel) vbox.addLayout(hbox) self.setLayout(vbox) self.choice = 'Yes'
def __init__(self, pattern): super(Option, self).__init__() parts = [p.replace('+', ' ') for p in pattern.split(" ")] self.command = parts[0] self.params = [] hbox = QtGui.QHBoxLayout() self.checkbox = QtGui.QCheckBox(self.command) hbox.addWidget(self.checkbox) for part in parts[1:]: if '<int>' == part: self.params.append(ParamInt()) elif '<str>' == part: self.params.append(ParamStr()) elif '<select{' == part[:len('<select{')]: self.params.append(ParamSelect( (part[len('<select{'):-2]).split('|'))) else: # assert(False) break hbox.addWidget(self.params[-1]) self.params[-1].trigger.connect(self.onParamChanged) hbox.addStretch(1) self.setLayout(hbox)
def __init__(self): super().__init__() # Init GUI self.setWindowTitle('Picasso: ToRaw') self.resize(768, 512) this_directory = os.path.dirname(os.path.realpath(__file__)) icon_path = os.path.join(this_directory, 'icons', 'toraw.ico') icon = QtGui.QIcon(icon_path) self.setWindowIcon(icon) vbox = QtGui.QVBoxLayout() self.setLayout(vbox) vbox.addWidget(QtGui.QLabel('Files:')) self.path_edit = TextEdit() vbox.addWidget(self.path_edit) hbox = QtGui.QHBoxLayout() vbox.addLayout(hbox) self.browse_button = QtGui.QPushButton('Browse') self.browse_button.clicked.connect(self.browse) hbox.addWidget(self.browse_button) hbox.addStretch(1) to_raw_button = QtGui.QPushButton('To raw') to_raw_button.clicked.connect(self.to_raw) hbox.addWidget(to_raw_button)
def create_mod_matrix(self): frame = Frame(self, 'Modulation Matrix') layout = QtGui.QVBoxLayout() frame.setLayout(layout) mod_id = 1 for r in range(16): line = QtGui.QHBoxLayout() layout.addLayout(line) src = BlofeldCombo(self, getattr(self.params, 'Modulation_{}_Source'.format(mod_id)), name='') amount = BlofeldSlider(self, getattr(self.params, 'Modulation_{}_Amount'.format(mod_id)), orientation=HORIZONTAL, inverted=True, name='') dest = BlofeldCombo(self, getattr(self.params, 'Modulation_{}_Destination'.format(mod_id)), name='') line.addWidget(src) line.addWidget(amount) line.addWidget(dest) mod_id += 1 return frame
def init(self, num): if self.mainwidget: self.mainwidget.setParent(None) self.mainwidget.deleteLater() self.mainwidget = gui.QWidget() self.layout = gui.QHBoxLayout() self.layout.setSpacing(2) self.bc = [] for i in range(num): bc = Bit_container("00", i) self.bc.append(bc) self.layout.addWidget(bc) self.mainwidget.setLayout(self.layout) self.setWidget(self.mainwidget)
def __init__(self, parent=None): super(buttonEditor, self).__init__(parent) self.ecurequestsparser = None self.layout = None self.layouth = gui.QHBoxLayout() self.buttontable = gui.QTableWidget() self.layoutv = gui.QVBoxLayout() self.layouth.addWidget(self.buttontable) self.layouth.addLayout(self.layoutv) self.buttondata = buttonData() self.layoutv.addWidget(self.buttondata) self.setLayout(self.layouth) self.buttontable.setFixedWidth(250) self.buttontable.setColumnCount(2) self.buttontable.verticalHeader().hide() self.buttontable.setSelectionBehavior(gui.QAbstractItemView.SelectRows) self.buttontable.setSelectionMode(gui.QAbstractItemView.SingleSelection) #self.buttontable.setShowGrid(False) self.buttontable.itemSelectionChanged.connect(self.selection_changed) self.enable_view(False)
def selectMode(self): self.obj.hide() #layout = QtGui.QHBoxLayout(O) #s = QtGui.QWidget() #layout.removeWidget(self.obj) #sessionMode = selectSession.Ui_Form() sessionMode.setupUi(self.obj) self.obj.show() self.startgame.hide() self.close.hide() self.showUserName.hide() self.changeUserName.hide() self.Instrution.hide() self.Score.hide() sessionMode.close.clicked.connect(self.closeApp) sessionMode.practice_session.clicked.connect(self.selectTopic) sessionMode.acceptchallenge.clicked.connect(self.joinChallenge) sessionMode.create_challenge.clicked.connect(self.challengeWordmap) sessionMode.back.clicked.connect(self.back2_1) #For Challenge #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
def __init__(self, name, parent, segmentation): super(RasterViewDockWidget, self).__init__(name, parent) self.canvas = RasterViewCanvas(segmentation=segmentation, selectionmodel=parent.roiselectionmodel) from PyQt4 import QtCore from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT self.toolbar_navigation = NavigationToolbar2QT(self.canvas, self, coordinates=False) self.toolbar_navigation.setOrientation(QtCore.Qt.Vertical) self.toolbar_navigation.setFloatable(True) self.widget = QtGui.QWidget() self.layout = QtGui.QHBoxLayout() self.layout.addWidget(self.toolbar_navigation) self.layout.addWidget(self.canvas) self.widget.setLayout(self.layout) self.setWidget(self.widget)
def __init__(self, name, parent, segmentation, selectionmodel): super(TraceViewDockWidget, self).__init__(name, parent) self.canvas = TraceViewCanvas(segmentation=segmentation, selectionmodel=selectionmodel) from PyQt4 import QtCore from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT self.toolbar_navigation = NavigationToolbar2QT(self.canvas, self, coordinates=False) self.toolbar_navigation.setOrientation(QtCore.Qt.Vertical) self.toolbar_navigation.setFloatable(True) self.widget = QtGui.QWidget() self.layout = QtGui.QHBoxLayout() self.layout.addWidget(self.toolbar_navigation) self.layout.addWidget(self.canvas) self.widget.setLayout(self.layout) self.setWidget(self.widget)
def initUI(self) : self.main_Vlayout = QtGui.QVBoxLayout(self) # top section self.top_Hlayout = QtGui.QHBoxLayout() self.top_left_Vlayout = QtGui.QVBoxLayout() self.label_info = QtGui.QLabel("") self.table_info = QtGui.QTableWidget() self.table_info.doubleClicked.connect(self.table_mouse_event) self.boxplot_frame = MplCanva() self.tab_genes = QtGui.QTabWidget(self) self.top_left_Vlayout.addWidget(self.label_info) self.top_left_Vlayout.addWidget(self.table_info) self.top_Hlayout.addLayout(self.top_left_Vlayout) self.top_Hlayout.addWidget(self.boxplot_frame) self.main_Vlayout.addLayout(self.top_Hlayout) self.main_Vlayout.addWidget(self.tab_genes)
def __init__ (self, parent = None): super(QCustomQWidget, self).__init__(parent) self.textQVBoxLayout = QtGui.QVBoxLayout() self.textUpQLabel = QtGui.QLabel() self.textDownQLabel = QtGui.QLabel() self.textQVBoxLayout.addWidget(self.textUpQLabel) self.textQVBoxLayout.addWidget(self.textDownQLabel) self.allQHBoxLayout = QtGui.QHBoxLayout() self.allQHBoxLayout.addLayout(self.textQVBoxLayout, 1) self.setLayout(self.allQHBoxLayout) # setStyleSheet self.textUpQLabel.setStyleSheet(''' color: rgb(0, 0, 255); ''') self.textDownQLabel.setStyleSheet(''' color: rgb(255, 0, 0); ''')
def __init__(self, parent=None): super(Main, self).__init__(parent) self.execute_button = QtGui.QPushButton('Choose folder') self.execute_button.clicked.connect(self.choose_folder) self.path_text = QtGui.QLineEdit("") self.layout = QtGui.QHBoxLayout() self.layout.addWidget(self.execute_button) self.layout.addWidget(self.path_text) self.central_widget = QtGui.QWidget() self.central_widget.setLayout(self.layout) self.setCentralWidget(self.central_widget)
def __init__(self, parent=None): super(Main, self).__init__(parent) self.execute_button = QtGui.QPushButton('Choose file') self.execute_button.clicked.connect(self.choose_file) self.path_text = QtGui.QLineEdit("") self.layout = QtGui.QHBoxLayout() self.layout.addWidget(self.execute_button) self.layout.addWidget(self.path_text) self.central_widget = QtGui.QWidget() self.central_widget.setLayout(self.layout) self.setCentralWidget(self.central_widget)
def __init__(self, parent=None): super(Main, self).__init__(parent) options = ['First option', 'Second option', 'Third option'] default_option = 0 self.combo_box = QtGui.QComboBox() for idx, option in enumerate(options): self.combo_box.insertItem(idx, option) if option == default_option: self.combo_box.setCurrentIndex(idx) # From http://doc.qt.io/qt-4.8/qcombobox.html#signals self.combo_box.currentIndexChanged.connect(self.on_dropdown_change) self.text_dropdown = QtGui.QLineEdit("") self.layout = QtGui.QHBoxLayout() self.layout.addWidget(self.combo_box) self.layout.addWidget(self.text_dropdown) self.central_widget = QtGui.QWidget() self.central_widget.setLayout(self.layout) self.setCentralWidget(self.central_widget)
def __init__(self, *args): QtWidgets.QFrame.__init__(self, *args) self.setFrameStyle(QtWidgets.QFrame.StyledPanel | QtWidgets.QFrame.Sunken) self.edit = self.PlainTextEdit() self.number_bar = self.NumberBar(self.edit) hbox = QtWidgets.QHBoxLayout(self) hbox.setSpacing(0) hbox.setContentsMargins(0,0,0,0) # setMargin hbox.addWidget(self.number_bar) hbox.addWidget(self.edit) self.edit.blockCountChanged.connect(self.number_bar.adjustWidth) self.edit.updateRequest.connect(self.number_bar.updateContents)
def quickLayout(self, type, ui_name=""): the_layout = '' if type in ("form", "QFormLayout"): the_layout = QtWidgets.QFormLayout() the_layout.setLabelAlignment(QtCore.Qt.AlignLeft) the_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow) elif type in ("grid", "QGridLayout"): the_layout = QtWidgets.QGridLayout() elif type in ("hbox", "QHBoxLayout"): the_layout = QtWidgets.QHBoxLayout() the_layout.setAlignment(QtCore.Qt.AlignTop) else: the_layout = QtWidgets.QVBoxLayout() the_layout.setAlignment(QtCore.Qt.AlignTop) if ui_name != "": self.uiList[ui_name] = the_layout return the_layout
def __init__(self, *args): QtGui.QFrame.__init__(self, *args) self.setFrameStyle(QtGui.QFrame.StyledPanel | QtGui.QFrame.Sunken) self.edit = self.PlainTextEdit() self.number_bar = self.NumberBar(self.edit) hbox = QtGui.QHBoxLayout(self) hbox.setSpacing(0) hbox.setContentsMargins(0,0,0,0) # setMargin hbox.addWidget(self.number_bar) hbox.addWidget(self.edit) self.edit.blockCountChanged.connect(self.number_bar.adjustWidth) self.edit.updateRequest.connect(self.number_bar.updateContents)
def __init__(self, parent=None, title="", collapsed=False): QtGui.QFrame.__init__(self, parent=parent) self.setMinimumHeight(24) self.move(QtCore.QPoint(24, 0)) self.setStyleSheet("border:1px solid rgb(41, 41, 41); ") self._hlayout = QtGui.QHBoxLayout(self) self._hlayout.setContentsMargins(0, 0, 0, 0) self._hlayout.setSpacing(0) self._arrow = None self._title = None self._hlayout.addWidget(self.initArrow(collapsed)) self._hlayout.addWidget(self.initTitle(title))
def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(400, 300) self.horizontalLayout = QtGui.QHBoxLayout(Form) self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.tableLayout = QtGui.QVBoxLayout() self.tableLayout.setObjectName(_fromUtf8("tableLayout")) self.horizontalLayout.addLayout(self.tableLayout) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.addAttr_btn = QtGui.QPushButton(Form) self.addAttr_btn.setMaximumSize(QtCore.QSize(30, 16777215)) self.addAttr_btn.setObjectName(_fromUtf8("addAttr_btn")) self.verticalLayout.addWidget(self.addAttr_btn) self.removeAttr_btn = QtGui.QPushButton(Form) self.removeAttr_btn.setMaximumSize(QtCore.QSize(30, 16777215)) self.removeAttr_btn.setObjectName(_fromUtf8("removeAttr_btn")) self.verticalLayout.addWidget(self.removeAttr_btn) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem) self.horizontalLayout.addLayout(self.verticalLayout) self.horizontalLayout.setStretch(0, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def __init__(self, mantype=""): QtGui.QWidget.__init__(self) self.setGeometry(100,100,900,700) view = QtGui.QTextBrowser(self) if mantype=="manual": view.setText(ph5_viewer_reader.html_manual) elif mantype=="whatsnew": view.setText(ph5_viewer_reader.html_whatsnew % PROG_VERSION) self.layout = QtGui.QHBoxLayout() self.layout.addWidget(view) self.setLayout(self.layout) self.show() ########################################## ############### CLASS #################### # Author: Lan # Updated: 201409 # CLASS: Seperator - is the line to separate in the Gui
def initUI(self): #print "ArrayGui.initUI(self)" #mainFrame = QtGui.QFrame(self);self.setCentralWidget(mainFrame) mainVbox = QtGui.QVBoxLayout(); #mainFrame.setLayout(mainbox) self.setLayout(mainVbox) #self.chBox = QtGui.QHBoxLayout(); mainVbox.addLayout(self.chBox) #self.chBox.addWidget(QtGui.QLabel('Channels:')) #self.chWidget = QtGui.QWidget() #chBox.addWidget(self.chWidget) #channelBox = QtGui.QHBoxLayout(); self.chWidget.setLayout(channelBox) arrayBox = QtGui.QHBoxLayout(); mainVbox.addLayout(arrayBox) self.arrayTabs = QtGui.QTabWidget(self); arrayBox.addWidget(self.arrayTabs) mainVbox.addWidget(QtGui.QLabel('NOTICE:')) self.statusCtrl = QtGui.QLabel('') mainVbox.addWidget(self.statusCtrl) #mainVbox.addStretch(1)
def __init__(self): QtGui.QWidget.__init__(self) self.setGeometry(300, 300, 600, 400) self.setWindowTitle('OCR Model') self.hbox = QtGui.QHBoxLayout(self) self.pic_lb = QtGui.QLabel(self) self.pic_lb.setFont(QtGui.QFont("Roman times",30,QtGui.QFont.Bold)) self.pic_lb.setAlignment(QtCore.Qt.AlignCenter) self.hbox.addWidget(self.pic_lb) self.setLayout(self.hbox) start = QtGui.QPushButton('Start', self) start.setGeometry(185, 10, 60, 40) start.clicked.connect(self.launch) self.next_pic = QtGui.QPushButton('Next', self) self.prev_pic = QtGui.QPushButton('Prev', self) self.next_pic.setGeometry(265, 10, 60, 40) self.prev_pic.setGeometry(345, 10, 60, 40)
def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(224, 117) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth()) Form.setSizePolicy(sizePolicy) self.verticalLayout = QtGui.QVBoxLayout(Form) self.verticalLayout.setSpacing(1) self.verticalLayout.setMargin(0) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.translateLabel = QtGui.QLabel(Form) self.translateLabel.setObjectName(_fromUtf8("translateLabel")) self.verticalLayout.addWidget(self.translateLabel) self.rotateLabel = QtGui.QLabel(Form) self.rotateLabel.setObjectName(_fromUtf8("rotateLabel")) self.verticalLayout.addWidget(self.rotateLabel) self.scaleLabel = QtGui.QLabel(Form) self.scaleLabel.setObjectName(_fromUtf8("scaleLabel")) self.verticalLayout.addWidget(self.scaleLabel) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.mirrorImageBtn = QtGui.QPushButton(Form) self.mirrorImageBtn.setToolTip(_fromUtf8("")) self.mirrorImageBtn.setObjectName(_fromUtf8("mirrorImageBtn")) self.horizontalLayout.addWidget(self.mirrorImageBtn) self.reflectImageBtn = QtGui.QPushButton(Form) self.reflectImageBtn.setObjectName(_fromUtf8("reflectImageBtn")) self.horizontalLayout.addWidget(self.reflectImageBtn) self.verticalLayout.addLayout(self.horizontalLayout) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, TokenDialog): TokenDialog.setObjectName(_fromUtf8("TokenDialog")) TokenDialog.resize(361, 213) self.centralwidget = QtGui.QWidget(TokenDialog) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.verticalLayoutWidget = QtGui.QWidget(self.centralwidget) self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 0, 361, 211)) self.verticalLayoutWidget.setObjectName(_fromUtf8("verticalLayoutWidget")) self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setMargin(0) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.listWidget = QtGui.QListWidget(self.verticalLayoutWidget) self.listWidget.setObjectName(_fromUtf8("listWidget")) self.verticalLayout.addWidget(self.listWidget) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.checkBox = QtGui.QCheckBox(self.verticalLayoutWidget) self.checkBox.setObjectName(_fromUtf8("checkBox")) self.horizontalLayout_2.addWidget(self.checkBox) self.spinBox = QtGui.QSpinBox(self.verticalLayoutWidget) self.spinBox.setMinimumSize(QtCore.QSize(50, 0)) self.spinBox.setMaximumSize(QtCore.QSize(50, 16777215)) self.spinBox.setObjectName(_fromUtf8("spinBox")) self.horizontalLayout_2.addWidget(self.spinBox) self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.pushButton = QtGui.QPushButton(self.verticalLayoutWidget) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.horizontalLayout.addWidget(self.pushButton) self.pushButton_2 = QtGui.QPushButton(self.verticalLayoutWidget) self.pushButton_2.setObjectName(_fromUtf8("pushButton_2")) self.horizontalLayout.addWidget(self.pushButton_2) self.verticalLayout.addLayout(self.horizontalLayout) TokenDialog.setCentralWidget(self.centralwidget) self.retranslateUi(TokenDialog) QtCore.QMetaObject.connectSlotsByName(TokenDialog)
def __init__(self, parent=None, item=None, title="Unnamed", default="a"): ''' :param parent: Parent `gui.DiagramEditor`. :param item: Store item for later processing. :param title: Window title. :param default: Default string text. ''' super(NameDialog, self).__init__(parent) self.setWindowTitle(title) self.lineEdit = QtGui.QLineEdit() self.lineEdit.setText( default ) self.lineEdit.setFocus( ) self.button = QtGui.QPushButton('Ok', self) self.button2 = QtGui.QPushButton('Cancel', self) vl = QtGui.QHBoxLayout(self) vl.addWidget(self.lineEdit) if isinstance(item, str): if "transition" in item: self.checkBox = QtGui.QCheckBox("Subnet") vl.addWidget(self.checkBox) hl = QtGui.QHBoxLayout() hl.addWidget(self.button) hl.addWidget(self.button2) vl.addLayout(hl) self.button.clicked.connect(self.ok) self.button2.clicked.connect(self.cancel) self.item = item #------------------------------------------------------------------------------------------------
def build_ui (self): """Build UI for the help window.""" splitter = QtGui.QSplitter() splitter.setOrientation(QtCore.Qt.Vertical) self.browser = HelpBrowser(splitter, self.engine) self.tree = self.engine.contentWidget() self.tree.setExpandsOnDoubleClick(False) self.tree.linkActivated.connect(self.browser.setSource) splitter.addWidget(self.tree) splitter.addWidget(self.browser) splitter.setSizes((70, 530)) hlayout = QtGui.QHBoxLayout() hlayout.addWidget(splitter) self.setLayout(hlayout) self.resize(800, 600)
def __init__(self, parent=None): QWidget.__init__(self, parent, Qt.WindowStaysOnTopHint | Qt.Window) self.setVisible(False) self._view_help = QWebView(self) self._view_help.load(resource_html("helppage.html")) self._view_help.show() f_layout = QHBoxLayout() f_layout.addWidget(self._view_help) self.setLayout(f_layout)
def _create_user_value(self): layout = QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0)
def initUi(self): """?????""" labelSymbol = QtGui.QLabel(u'??:') self.lineSymbol = QtGui.QLineEdit() self.lineSymbol.setText('IF1704') grid = QtGui.QGridLayout() grid.addWidget(labelSymbol, 0, 0) grid.addWidget(self.lineSymbol, 0, 1) # ???????? buttonShowDaily = QtGui.QPushButton(u'??????') size = buttonShowDaily.sizeHint() buttonShowDaily.setMinimumHeight(size.height()*2) # ??????????? # ???? hbox = QtGui.QHBoxLayout() hbox.addLayout(grid) vbox = QtGui.QVBoxLayout() vbox.addLayout(hbox) vbox.addWidget(buttonShowDaily) vbox.addStretch() self.setLayout(vbox) # ?? buttonShowDaily.clicked.connect(self.openExe) #show self.lineSymbol.returnPressed.connect(self.openExe) #show #----------------------------------------------------------------------
def initUi(self): """?????""" labelSymbol = QtGui.QLabel(u'??:') lableDay = QtGui.QLabel(u'??:') self.lineSymbol = QtGui.QLineEdit() self.lineSymbol.setText('IF1704') self.lineDay = QtGui.QLineEdit() self.lineDay.setText('2017-03-14') grid = QtGui.QGridLayout() grid.addWidget(labelSymbol, 0, 0) grid.addWidget(lableDay, 1, 0) grid.addWidget(self.lineSymbol, 0, 1) grid.addWidget(self.lineDay, 1, 1) # ??exe?????? buttonShowMin = QtGui.QPushButton(u'???????') size = buttonShowMin.sizeHint() buttonShowMin.setMinimumHeight(size.height()*2) # ??????????? # ???? hbox = QtGui.QHBoxLayout() hbox.addLayout(grid) vbox = QtGui.QVBoxLayout() vbox.addLayout(hbox) vbox.addWidget(buttonShowMin) vbox.addStretch() self.setLayout(vbox) # ?? buttonShowMin.clicked.connect(self.openExe)
def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(342, 125) self.horizontalLayout_3 = QtGui.QHBoxLayout(Form) self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.expressionLabel = QtGui.QLabel(Form) self.expressionLabel.setObjectName(_fromUtf8("expressionLabel")) self.horizontalLayout.addWidget(self.expressionLabel) self.expressionLineEdit = QtGui.QLineEdit(Form) self.expressionLineEdit.setObjectName(_fromUtf8("expressionLineEdit")) self.horizontalLayout.addWidget(self.expressionLineEdit) self.evaluatePushButton = QtGui.QPushButton(Form) self.evaluatePushButton.setObjectName(_fromUtf8("evaluatePushButton")) self.horizontalLayout.addWidget(self.evaluatePushButton) self.verticalLayout.addLayout(self.horizontalLayout) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.variableValueLabel = QtGui.QLabel(Form) self.variableValueLabel.setObjectName(_fromUtf8("variableValueLabel")) self.horizontalLayout_2.addWidget(self.variableValueLabel) self.variableValueLineEdit = QtGui.QLineEdit(Form) self.variableValueLineEdit.setObjectName(_fromUtf8("variableValueLineEdit")) self.horizontalLayout_2.addWidget(self.variableValueLineEdit) self.setPushButton = QtGui.QPushButton(Form) self.setPushButton.setObjectName(_fromUtf8("setPushButton")) self.horizontalLayout_2.addWidget(self.setPushButton) self.verticalLayout.addLayout(self.horizontalLayout_2) self.evaluatedExpressionLabel = QtGui.QLabel(Form) self.evaluatedExpressionLabel.setObjectName(_fromUtf8("evaluatedExpressionLabel")) self.verticalLayout.addWidget(self.evaluatedExpressionLabel) self.horizontalLayout_3.addLayout(self.verticalLayout) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, PlotterCreator): PlotterCreator.setObjectName(_fromUtf8("PlotterCreator")) PlotterCreator.resize(183, 99) self.horizontalLayout_3 = QtGui.QHBoxLayout(PlotterCreator) self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.graphLabel = QtGui.QLabel(PlotterCreator) self.graphLabel.setObjectName(_fromUtf8("graphLabel")) self.horizontalLayout.addWidget(self.graphLabel) self.graphSpinBox = QtGui.QSpinBox(PlotterCreator) self.graphSpinBox.setMinimum(1) self.graphSpinBox.setMaximum(10) self.graphSpinBox.setObjectName(_fromUtf8("graphSpinBox")) self.horizontalLayout.addWidget(self.graphSpinBox) self.verticalLayout.addLayout(self.horizontalLayout) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.label = QtGui.QLabel(PlotterCreator) self.label.setObjectName(_fromUtf8("label")) self.horizontalLayout_2.addWidget(self.label) self.noOfDataLineEdit = QtGui.QLineEdit(PlotterCreator) self.noOfDataLineEdit.setObjectName(_fromUtf8("noOfDataLineEdit")) self.horizontalLayout_2.addWidget(self.noOfDataLineEdit) self.verticalLayout.addLayout(self.horizontalLayout_2) self.pushButton = QtGui.QPushButton(PlotterCreator) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.verticalLayout.addWidget(self.pushButton) self.horizontalLayout_3.addLayout(self.verticalLayout) self.retranslateUi(PlotterCreator) QtCore.QMetaObject.connectSlotsByName(PlotterCreator)
def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.resize(196, 71) self.verticalLayout_2 = QtGui.QVBoxLayout(Dialog) self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.label = QtGui.QLabel(Dialog) self.label.setObjectName(_fromUtf8("label")) self.horizontalLayout.addWidget(self.label) self.lineEdit = QtGui.QLineEdit(Dialog) self.lineEdit.setObjectName(_fromUtf8("lineEdit")) self.horizontalLayout.addWidget(self.lineEdit) self.verticalLayout.addLayout(self.horizontalLayout) self.buttonBox = QtGui.QDialogButtonBox(Dialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName(_fromUtf8("buttonBox")) self.verticalLayout.addWidget(self.buttonBox) self.verticalLayout_2.addLayout(self.verticalLayout) self.retranslateUi(Dialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), Dialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Dialog.reject) QtCore.QMetaObject.connectSlotsByName(Dialog)
def init_UI(self): self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setWindowTitle('Dragonfly Frame Viewer') window = QtWidgets.QWidget() self.hbox = QtWidgets.QHBoxLayout() self.frame_panel = frame_panel.Frame_panel(self, powder=self.do_powder, compare=self.do_compare) self.hbox.addWidget(self.frame_panel) # Menu items menubar = self.menuBar() menubar.setNativeMenuBar(False) # Theme picker thememenu = menubar.addMenu('&Theme') self.theme = QtWidgets.QActionGroup(self, exclusive=True) for i, s in enumerate(map(str, list(QtWidgets.QStyleFactory.keys()))): a = self.theme.addAction(QtWidgets.QAction(s, self, checkable=True)) if i == 0: a.setChecked(True) a.triggered.connect(self.theme_changed) thememenu.addAction(a) # Color map picker cmapmenu = menubar.addMenu('&Color Map') self.color_map = QtWidgets.QActionGroup(self, exclusive=True) for i, s in enumerate(['cubehelix', 'CMRmap', 'gray', 'gray_r', 'jet']): a = self.color_map.addAction(QtWidgets.QAction(s, self, checkable=True)) if i == 0: a.setChecked(True) a.triggered.connect(self.cmap_changed) cmapmenu.addAction(a) window.setLayout(self.hbox) self.setCentralWidget(window) self.show()
def init_UI(self): self.vbox = QtWidgets.QVBoxLayout(self) label = QtWidgets.QLabel('Multi-layer Perceptron', self) self.vbox.addWidget(label) hbox = QtWidgets.QHBoxLayout() self.vbox.addLayout(hbox) label = QtWidgets.QLabel('Hidden layer sizes', self) hbox.addWidget(label) self.layer_sizes = QtWidgets.QLineEdit('10, 10', self) self.layer_sizes.setFixedWidth(80) self.layer_sizes.editingFinished.connect(self.remake_mlp) hbox.addWidget(self.layer_sizes) hbox = QtWidgets.QHBoxLayout() self.vbox.addLayout(hbox) label = QtWidgets.QLabel('alpha', self) hbox.addWidget(label) self.alpha_var = QtWidgets.QLineEdit('0.1', self) self.alpha_var.setFixedWidth(80) self.alpha_var.editingFinished.connect(self.remake_mlp) hbox.addWidget(self.alpha_var) hbox = QtWidgets.QHBoxLayout() self.vbox.addLayout(hbox) button = QtWidgets.QPushButton('Update', self) button.clicked.connect(self.remake_mlp) hbox.addWidget(button) hbox.addStretch(1) hbox = QtWidgets.QHBoxLayout() self.vbox.addLayout(hbox) button = QtWidgets.QPushButton('Train', self) button.clicked.connect(self.train) hbox.addWidget(button) hbox.addStretch(1) self.vbox.addStretch(1)