Python PyQt5.QtWidgets.QSpinBox() Examples
The following are 30
code examples of PyQt5.QtWidgets.QSpinBox().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtWidgets
, or try the search function
.
Example #1
Source File: dataeditor.py From ddt4all with GNU General Public License v3.0 | 6 votes |
def __init__(self, dataitem, parent=None): super(otherPanel, self).__init__(parent) self.setFrameStyle(widgets.QFrame.Sunken) self.setFrameShape(widgets.QFrame.Box) self.data = dataitem layout = widgets.QGridLayout() labelnob = widgets.QLabel(_("Number of bytes")) lableunit = widgets.QLabel(_("Unit")) layout.addWidget(labelnob, 0, 0) layout.addWidget(lableunit, 1, 0) layout.setRowStretch(2, 1) self.inputnob = widgets.QSpinBox() self.inputnob.setRange(1, 10240) self.inputtype = widgets.QComboBox() self.inputtype.addItem("ASCII") self.inputtype.addItem("BCD/HEX") layout.addWidget(self.inputnob, 0, 1) layout.addWidget(self.inputtype, 1, 1) self.setLayout(layout) self.init()
Example #2
Source File: main.py From vidpipe with GNU General Public License v3.0 | 6 votes |
def saveFilterValue( self, obj ): assert( isinstance( obj.caller, QSpinBox ) or isinstance( obj.caller, QCheckBox ) or isinstance( obj.caller, QLineEdit ) ) if isinstance( obj.caller, QSpinBox ): newVal = obj.caller.value() elif isinstance( obj.caller, QCheckBox ): newVal = obj.caller.isChecked() elif isinstance( obj.caller, QLineEdit ): if self.check_state( obj.caller ) != True: return newVal = [ int( t ) for t in obj.caller.text().split( "," ) ] try: func = getattr( obj.called, obj.action ) except AttributeError: print( "Whoops, for some reason the callback isn't valid." ) else: result = func( newVal ) # reset the frame rate self._frameRate_RunningAvg = -1
Example #3
Source File: configurator.py From awesometts-anki-addon with GNU General Public License v3.0 | 6 votes |
def accept(self): """Saves state on inputs; rough opposite of show().""" for list_view in self.findChildren(QtWidgets.QListView): for editor in list_view.findChildren(QtWidgets.QWidget, 'editor'): list_view.commitData(editor) # if an editor is open, save it self._addon.config.update({ widget.objectName(): ( widget.isChecked() if isinstance(widget, Checkbox) else widget.atts_value if isinstance(widget, QtWidgets.QPushButton) else widget.value() if isinstance(widget, QtWidgets.QSpinBox) else widget.itemData(widget.currentIndex()) if isinstance( widget, QtWidgets.QComboBox) else [ i for i in widget.model().raw_data if i['compiled'] and 'bad_replace' not in i ] if isinstance(widget, QtWidgets.QListView) else widget.text() ) for widget in self.findChildren(self._PROPERTY_WIDGETS) if widget.objectName() in self._PROPERTY_KEYS }) super(Configurator, self).accept()
Example #4
Source File: Widgets.py From PyRAT with Mozilla Public License 2.0 | 6 votes |
def __init__(self, title=None, parent=None): super(CropBoxWidget, self).__init__(parent) self.value = [0]*4 layout = QtWidgets.QGridLayout(self) if isinstance(title, str): layout.addWidget(QtWidgets.QLabel(title), 0, 0) self.crop1 = QtWidgets.QSpinBox() self.crop2 = QtWidgets.QSpinBox() self.crop3 = QtWidgets.QSpinBox() self.crop4 = QtWidgets.QSpinBox() cropbox = QtWidgets.QGridLayout() cropbox.addWidget(QtWidgets.QLabel("range start"), 0, 0) cropbox.addWidget(self.crop1, 1, 0) cropbox.addWidget(QtWidgets.QLabel("range end"), 2, 0) cropbox.addWidget(self.crop2, 3, 0) cropbox.addWidget(QtWidgets.QLabel("azimuth start"), 0, 1) cropbox.addWidget(self.crop3, 1, 1) cropbox.addWidget(QtWidgets.QLabel("azimuth end"), 2, 1) cropbox.addWidget(self.crop4, 3, 1) layout.addLayout(cropbox, 1, 0) self.minmaxMemory = [] self.setrange([[0, 9999999], [0, 9999999], [0, 9999999], [0, 9999999]]) self.setContentsMargins(0, 0, 0, 0) self.layout().setContentsMargins(0, 0, 0, 0)
Example #5
Source File: model_wizard.py From CvStudio with MIT License | 6 votes |
def __init__(self, parent=None): super(BaseModelSelectionPage, self).__init__(parent) self.setTitle("Base Model Selection") self._layout = QVBoxLayout(self) _model_section_widget = QWidget() _section_layout = QFormLayout(_model_section_widget) self.ds_picker = DatasetPicker() self.arch_picker = ModelPicker() self._num_of_epochs_picker = QSpinBox() self._num_of_workers_picker = QSpinBox() self._batch_size_picker = QSpinBox() self._learning_rate_picker = QDoubleSpinBox() self._learning_momentum_picker = QDoubleSpinBox() self._learning_weight_decay_picker = QDoubleSpinBox() self._learning_weight_decay_picker = QDoubleSpinBox() _section_layout.addRow(self.tr("Dataset: "), self.ds_picker) _section_layout.addRow(self.tr("Architecture: "), self.arch_picker) _section_layout.addRow(self.tr("Number of epochs: "), self._num_of_epochs_picker) _section_layout.addRow(self.tr("Number of workers: "), self._num_of_workers_picker) _section_layout.addRow(self.tr("Batch Size: "), self._batch_size_picker) _section_layout.addRow(self.tr("Learning rate: "), self._learning_rate_picker) self._layout.addWidget(GUIUtilities.wrap_with_groupbox(_model_section_widget, "Model Details"))
Example #6
Source File: gui.py From code-jam-5 with MIT License | 6 votes |
def __init__(self, settings, parent=None): super(SettingsPop, self).__init__(parent) self.main_layout = QtWidgets.QVBoxLayout() self.fps_layout = QtWidgets.QHBoxLayout() self.fps_label = QtWidgets.QLabel() self.fps_spin = QtWidgets.QSpinBox() self.step_layout = QtWidgets.QHBoxLayout() self.step_label = QtWidgets.QLabel() self.step_combo = QtWidgets.QComboBox() self.color_map_layout = QtWidgets.QHBoxLayout() self.color_map = QtWidgets.QPushButton() self.color_map_label = QtWidgets.QLabel() self.settings = settings self.save_button = QtWidgets.QPushButton() self.license_button = QtWidgets.QPushButton()
Example #7
Source File: dialogs.py From Miyamoto with GNU General Public License v3.0 | 6 votes |
def __init__(self, type=Type_TextBox): super().__init__() self.label = QtWidgets.QLabel('-') self.label.setWordWrap(True) if type == InputBox.Type_TextBox: self.textbox = QtWidgets.QLineEdit() widget = self.textbox elif type == InputBox.Type_SpinBox: self.spinbox = QtWidgets.QSpinBox() widget = self.spinbox elif type == InputBox.Type_HexSpinBox: self.spinbox = HexSpinBox() widget = self.spinbox self.buttons = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject) self.layout = QtWidgets.QVBoxLayout() self.layout.addWidget(self.label) self.layout.addWidget(widget) self.layout.addWidget(self.buttons) self.setLayout(self.layout)
Example #8
Source File: puzzle.py From Miyamoto with GNU General Public License v3.0 | 6 votes |
def __init__(self): super().__init__() self.setVisible(False) layout = QtWidgets.QHBoxLayout(self) layout.setSpacing(0) layout.setContentsMargins(0,0,0,0) self.spinbox = QtWidgets.QSpinBox() self.spinbox.setFixedSize(32, 24) self.spinbox.valueChanged.connect(self.valChanged) layout.addWidget(self.spinbox) self.updating = False self.setFixedWidth(32)
Example #9
Source File: puzzle.py From Miyamoto with GNU General Public License v3.0 | 6 votes |
def __init__(self): super().__init__() self.setVisible(False) layout = QtWidgets.QHBoxLayout(self) layout.setSpacing(0) layout.setContentsMargins(0,0,0,0) spinbox1 = QtWidgets.QSpinBox() spinbox1.setFixedSize(32, 24) spinbox1.valueChanged.connect(self.startValChanged) layout.addWidget(spinbox1) spinbox2 = QtWidgets.QSpinBox() spinbox2.setFixedSize(32, 24) spinbox2.valueChanged.connect(self.endValChanged) layout.addWidget(spinbox2) self.spinboxes = (spinbox1, spinbox2) self.updating = False self.setFixedWidth(64)
Example #10
Source File: average.py From picasso with MIT License | 6 votes |
def __init__(self, window): super().__init__(window) self.window = window self.setWindowTitle("Parameters") self.setModal(False) grid = QtWidgets.QGridLayout(self) grid.addWidget(QtWidgets.QLabel("Oversampling:"), 0, 0) self.oversampling = QtWidgets.QDoubleSpinBox() self.oversampling.setRange(1, 1e7) self.oversampling.setValue(10) self.oversampling.setDecimals(1) self.oversampling.setKeyboardTracking(False) self.oversampling.valueChanged.connect(self.window.view.update_image) grid.addWidget(self.oversampling, 0, 1) grid.addWidget(QtWidgets.QLabel("Iterations:"), 1, 0) self.iterations = QtWidgets.QSpinBox() self.iterations.setRange(0, 1e7) self.iterations.setValue(10) grid.addWidget(self.iterations, 1, 1)
Example #11
Source File: average3.py From picasso with MIT License | 6 votes |
def __init__(self, window): super().__init__(window) self.window = window self.setWindowTitle("Parameters") self.setModal(False) grid = QtWidgets.QGridLayout(self) grid.addWidget(QtWidgets.QLabel("Oversampling:"), 0, 0) self.oversampling = QtWidgets.QDoubleSpinBox() self.oversampling.setRange(1, 200) self.oversampling.setValue(DEFAULT_OVERSAMPLING) self.oversampling.setDecimals(1) self.oversampling.setKeyboardTracking(False) self.oversampling.valueChanged.connect(self.window.updateLayout) grid.addWidget(self.oversampling, 0, 1) self.iterations = QtWidgets.QSpinBox() self.iterations.setRange(1, 1) self.iterations.setValue(1)
Example #12
Source File: define_channel.py From asammdf with GNU Lesser General Public License v3.0 | 6 votes |
def op1_constant_changed(self, index): if self.op1_type.currentText() == "int": if self.op1_value is not None: self.op1_value.setParent(None) self.op1_value = None self.op1_value = QtWidgets.QSpinBox() self.op1_value.setRange(-2147483648, 2147483647) self.gridLayout.addWidget(self.op1_value, 0, 3) else: if self.op1_value is not None: self.op1_value.setParent(None) self.op1_value = None self.op1_value = QtWidgets.QDoubleSpinBox() self.op1_value.setDecimals(6) self.op1_value.setRange(-(2 ** 64), 2 ** 64 - 1) self.gridLayout.addWidget(self.op1_value, 0, 3)
Example #13
Source File: define_channel.py From asammdf with GNU Lesser General Public License v3.0 | 6 votes |
def op2_constant_changed(self, index): if self.op2_type.currentText() == "int": if self.op2_value is not None: self.op2_value.setParent(None) self.op2_value = None self.op2_value = QtWidgets.QSpinBox() self.op2_value.setRange(-2147483648, 2147483647) self.gridLayout.addWidget(self.op2_value, 2, 3) else: if self.op2_value is not None: self.op2_value.setParent(None) self.op2_value = None self.op2_value = QtWidgets.QDoubleSpinBox() self.op2_value.setDecimals(6) self.op2_value.setRange(-(2 ** 64), 2 ** 64 - 1) self.gridLayout.addWidget(self.op2_value, 2, 3)
Example #14
Source File: rest_settings_wt.py From mindfulness-at-the-computer with GNU General Public License v3.0 | 6 votes |
def __init__(self): super().__init__() self.updating_gui_bool = False self.toggle_switch = ToggleSwitchWt() self.both_qrb = RadioButtonLeft(self.tr("Visual + Audio")) self.visual_qrb = RadioButtonMiddle(self.tr("Visual")) self.audio_qrb = RadioButtonRight(self.tr("Audio")) self.notification_interval_qsb = QtWidgets.QSpinBox() self.notif_select_audio_qpb = QtWidgets.QPushButton(self.tr("Select audio")) self.notif_volume_qsr = QtWidgets.QSlider() self.phrases_qlw = RestActionListWt() self._init_ui() self._connect_slots_to_signals()
Example #15
Source File: meme_gen.py From Mastering-GUI-Programming-with-Python with MIT License | 5 votes |
def __init__(self): super().__init__() self.setLayout(qtw.QFormLayout()) # Image self.image_source = ImageFileButton(changed=self.on_change) self.layout().addRow('Image file', self.image_source) # Text entries self.top_text = qtw.QPlainTextEdit(textChanged=self.on_change) self.bottom_text = qtw.QPlainTextEdit(textChanged=self.on_change) self.layout().addRow("Top Text", self.top_text) self.layout().addRow("Bottom Text", self.bottom_text) # Text color and font self.text_color = ColorButton('white', changed=self.on_change) self.layout().addRow("Text Color", self.text_color) self.text_font = FontButton('Impact', 32, changed=self.on_change) self.layout().addRow("Text Font", self.text_font) # Background Boxes self.text_bg_color = ColorButton('black', changed=self.on_change) self.layout().addRow('Text Background', self.text_bg_color) self.top_bg_height = qtw.QSpinBox( minimum=0, maximum=32, valueChanged=self.on_change, suffix=' line(s)') self.layout().addRow('Top BG height', self.top_bg_height) self.bottom_bg_height = qtw.QSpinBox( minimum=0, maximum=32, valueChanged=self.on_change, suffix=' line(s)') self.layout().addRow('Bottom BG height', self.bottom_bg_height) self.bg_padding = qtw.QSpinBox( minimum=0, maximum=100, value=10, valueChanged=self.on_change, suffix=' px') self.layout().addRow('BG Padding', self.bg_padding)
Example #16
Source File: dialogs.py From Miyamoto with GNU General Public License v3.0 | 5 votes |
def __init__(self): """ Creates and initializes the dialog """ super().__init__() self.setWindowTitle(globals.trans.string('ShftItmDlg', 0)) self.setWindowIcon(GetIcon('move')) self.XOffset = QtWidgets.QSpinBox() self.XOffset.setRange(-16384, 16383) self.YOffset = QtWidgets.QSpinBox() self.YOffset.setRange(-8192, 8191) buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject) moveLayout = QtWidgets.QFormLayout() offsetlabel = QtWidgets.QLabel(globals.trans.string('ShftItmDlg', 2)) offsetlabel.setWordWrap(True) moveLayout.addWidget(offsetlabel) moveLayout.addRow(globals.trans.string('ShftItmDlg', 3), self.XOffset) moveLayout.addRow(globals.trans.string('ShftItmDlg', 4), self.YOffset) moveGroupBox = QtWidgets.QGroupBox(globals.trans.string('ShftItmDlg', 1)) moveGroupBox.setLayout(moveLayout) mainLayout = QtWidgets.QVBoxLayout() mainLayout.addWidget(moveGroupBox) mainLayout.addWidget(buttonBox) self.setLayout(mainLayout)
Example #17
Source File: dialogs.py From Miyamoto with GNU General Public License v3.0 | 5 votes |
def __init__(self): """ Creates and initializes the dialog """ super().__init__() self.setWindowTitle('Swap Objects\' Tilesets') self.setWindowIcon(GetIcon('swap')) # Create widgets self.FromTS = QtWidgets.QSpinBox() self.FromTS.setRange(1, 4) self.ToTS = QtWidgets.QSpinBox() self.ToTS.setRange(1, 4) # Swap layouts swapLayout = QtWidgets.QFormLayout() swapLayout.addRow('From tileset:', self.FromTS) swapLayout.addRow('To tileset:', self.ToTS) self.DoExchange = QtWidgets.QCheckBox('Exchange (perform 2-way conversion)') # Buttonbox buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject) # Main layout mainLayout = QtWidgets.QVBoxLayout() mainLayout.addLayout(swapLayout) mainLayout.addWidget(self.DoExchange) mainLayout.addWidget(buttonBox) self.setLayout(mainLayout)
Example #18
Source File: dialogs.py From Miyamoto with GNU General Public License v3.0 | 5 votes |
def createBounds(self, z): self.Bounds = QtWidgets.QGroupBox(globals.trans.string('ZonesDlg', 47)) self.Zone_yboundup = QtWidgets.QSpinBox() self.Zone_yboundup.setRange(-32766, 32767) self.Zone_yboundup.setToolTip(globals.trans.string('ZonesDlg', 49)) self.Zone_yboundup.setSpecialValueText('32') self.Zone_yboundup.setValue(z.yupperbound) self.Zone_ybounddown = QtWidgets.QSpinBox() self.Zone_ybounddown.setRange(-32766, 32767) self.Zone_ybounddown.setToolTip(globals.trans.string('ZonesDlg', 51)) self.Zone_ybounddown.setValue(z.ylowerbound) self.Zone_yboundup2 = QtWidgets.QSpinBox() self.Zone_yboundup2.setRange(-32766, 32767) self.Zone_yboundup2.setToolTip(globals.trans.string('ZonesDlg', 71)) self.Zone_yboundup2.setValue(z.yupperbound2) self.Zone_ybounddown2 = QtWidgets.QSpinBox() self.Zone_ybounddown2.setRange(-32766, 32767) self.Zone_ybounddown2.setToolTip(globals.trans.string('ZonesDlg', 73)) self.Zone_ybounddown2.setValue(z.ylowerbound2) self.Zone_boundflg = QtWidgets.QCheckBox() self.Zone_boundflg.setToolTip(globals.trans.string('ZonesDlg', 75)) self.Zone_boundflg.setChecked(z.unknownbnf == 0xF) LA = QtWidgets.QFormLayout() LA.addRow(globals.trans.string('ZonesDlg', 48), self.Zone_yboundup) LA.addRow(globals.trans.string('ZonesDlg', 50), self.Zone_ybounddown) LA.addRow(globals.trans.string('ZonesDlg', 74), self.Zone_boundflg) LB = QtWidgets.QFormLayout() LB.addRow(globals.trans.string('ZonesDlg', 70), self.Zone_yboundup2) LB.addRow(globals.trans.string('ZonesDlg', 72), self.Zone_ybounddown2) LC = QtWidgets.QGridLayout() LC.addLayout(LA, 0, 0) LC.addLayout(LB, 0, 1) self.Bounds.setLayout(LC)
Example #19
Source File: util.py From incremental-reading with ISC License | 5 votes |
def createSpinBox(value, minimum, maximum, step): spinBox = QSpinBox() spinBox.setRange(minimum, maximum) spinBox.setSingleStep(step) spinBox.setValue(value) return spinBox
Example #20
Source File: ui_scientific_number_scroller_widget.py From MDT with GNU Lesser General Public License v3.0 | 5 votes |
def setupUi(self, ScientificScroller): ScientificScroller.setObjectName("ScientificScroller") ScientificScroller.resize(283, 61) self.horizontalLayout = QtWidgets.QHBoxLayout(ScientificScroller) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setSpacing(3) self.horizontalLayout.setObjectName("horizontalLayout") self.mantissa = QDoubleSpinBoxDotSeparator(ScientificScroller) self.mantissa.setSpecialValueText("") self.mantissa.setDecimals(4) self.mantissa.setMinimum(-1000.0) self.mantissa.setMaximum(1000.0) self.mantissa.setSingleStep(0.01) self.mantissa.setObjectName("mantissa") self.horizontalLayout.addWidget(self.mantissa) self.label = QtWidgets.QLabel(ScientificScroller) self.label.setObjectName("label") self.horizontalLayout.addWidget(self.label) self.exponent = QtWidgets.QSpinBox(ScientificScroller) self.exponent.setMinimum(-99) self.exponent.setObjectName("exponent") self.horizontalLayout.addWidget(self.exponent) self.horizontalLayout.setStretch(0, 1) self.retranslateUi(ScientificScroller) QtCore.QMetaObject.connectSlotsByName(ScientificScroller)
Example #21
Source File: demoSpinBox.py From Qt5-Python-GUI-Programming-Cookbook with MIT License | 5 votes |
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(580, 162) self.label = QtWidgets.QLabel(Dialog) self.label.setGeometry(QtCore.QRect(16, 30, 81, 20)) font = QtGui.QFont() font.setPointSize(12) self.label.setFont(font) self.label.setObjectName("label") self.lineEditBookPrice = QtWidgets.QLineEdit(Dialog) self.lineEditBookPrice.setGeometry(QtCore.QRect(120, 30, 113, 20)) font = QtGui.QFont() font.setPointSize(12) self.lineEditBookPrice.setFont(font) self.lineEditBookPrice.setObjectName("lineEditBookPrice") self.spinBoxBookQty = QtWidgets.QSpinBox(Dialog) self.spinBoxBookQty.setGeometry(QtCore.QRect(290, 30, 42, 22)) font = QtGui.QFont() font.setPointSize(12) self.spinBoxBookQty.setFont(font) self.spinBoxBookQty.setObjectName("spinBoxBookQty") self.lineEditBookAmount = QtWidgets.QLineEdit(Dialog) self.lineEditBookAmount.setGeometry(QtCore.QRect(390, 30, 113, 20)) font = QtGui.QFont() font.setPointSize(12) self.lineEditBookAmount.setFont(font) self.lineEditBookAmount.setObjectName("lineEditBookAmount") self.label_2 = QtWidgets.QLabel(Dialog) self.label_2.setGeometry(QtCore.QRect(10, 70, 81, 21)) font = QtGui.QFont() font.setPointSize(12) self.label_2.setFont(font) self.label_2.setObjectName("label_2") self.lineEditSugarPrice = QtWidgets.QLineEdit(Dialog) self.lineEditSugarPrice.setGeometry(QtCore.QRect(120, 70, 113, 20)) font = QtGui.QFont() font.setPointSize(12) self.lineEditSugarPrice.setFont(font) self.lineEditSugarPrice.setObjectName("lineEditSugarPrice") self.doubleSpinBoxSugarWeight = QtWidgets.QDoubleSpinBox(Dialog) self.doubleSpinBoxSugarWeight.setGeometry(QtCore.QRect(290, 70, 62, 22)) font = QtGui.QFont() font.setPointSize(12) self.doubleSpinBoxSugarWeight.setFont(font) self.doubleSpinBoxSugarWeight.setObjectName("doubleSpinBoxSugarWeight") self.lineEditSugarAmount = QtWidgets.QLineEdit(Dialog) self.lineEditSugarAmount.setGeometry(QtCore.QRect(390, 70, 113, 20)) font = QtGui.QFont() font.setPointSize(12) self.lineEditSugarAmount.setFont(font) self.lineEditSugarAmount.setObjectName("lineEditSugarAmount") self.labelTotalAmount = QtWidgets.QLabel(Dialog) self.labelTotalAmount.setGeometry(QtCore.QRect(396, 120, 121, 20)) font = QtGui.QFont() font.setPointSize(12) self.labelTotalAmount.setFont(font) self.labelTotalAmount.setObjectName("labelTotalAmount") self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
Example #22
Source File: invoice_maker.py From Mastering-GUI-Programming-with-Python with MIT License | 5 votes |
def __init__(self): super().__init__() self.setLayout(qtw.QFormLayout()) self.inputs = {} self.inputs['Customer Name'] = qtw.QLineEdit() self.inputs['Customer Address'] = qtw.QPlainTextEdit() self.inputs['Invoice Date'] = qtw.QDateEdit( date=qtc.QDate.currentDate(), calendarPopup=True) self.inputs['Days until Due'] = qtw.QSpinBox( minimum=0, maximum=60, value=30) for label, widget in self.inputs.items(): self.layout().addRow(label, widget) self.line_items = qtw.QTableWidget( rowCount=10, columnCount=3) self.line_items.setHorizontalHeaderLabels( ['Job', 'Rate', 'Hours']) self.line_items.horizontalHeader().setSectionResizeMode( qtw.QHeaderView.Stretch) self.layout().addRow(self.line_items) for row in range(self.line_items.rowCount()): for col in range(self.line_items.columnCount()): if col > 0: w = qtw.QSpinBox(minimum=0, maximum=300) self.line_items.setCellWidget(row, col, w) submit = qtw.QPushButton('Create Invoice', clicked=self.on_submit) self.layout().addRow(submit)
Example #23
Source File: hasher.py From Mastering-GUI-Programming-with-Python with MIT License | 5 votes |
def __init__(self): super().__init__() self.setLayout(qtw.QFormLayout()) self.source_path = qtw.QPushButton( 'Click to select…', clicked=self.on_source_click) self.layout().addRow('Source Path', self.source_path) self.destination_file = qtw.QPushButton( 'Click to select…', clicked=self.on_dest_click) self.layout().addRow('Destination File', self.destination_file) self.threads = qtw.QSpinBox(minimum=1, maximum=7, value=2) self.layout().addRow('Threads', self.threads) submit = qtw.QPushButton('Go', clicked=self.on_submit) self.layout().addRow(submit)
Example #24
Source File: misc.py From Miyamoto with GNU General Public License v3.0 | 5 votes |
def setMinimum(self, value): self.validator.min = value QtWidgets.QSpinBox.setMinimum(self, value)
Example #25
Source File: question_4_example_code.py From Mastering-GUI-Programming-with-Python with MIT License | 5 votes |
def __init__(self): super().__init__() self.setLayout(qtw.QFormLayout()) # Image self.image_source = ImageFileButton(changed=self.on_change) self.layout().addRow('Image file', self.image_source) # Text entries self.top_text = qtw.QPlainTextEdit(textChanged=self.on_change) self.bottom_text = qtw.QPlainTextEdit(textChanged=self.on_change) self.layout().addRow("Top Text", self.top_text) self.layout().addRow("Bottom Text", self.bottom_text) # Text color and font self.text_color = ColorButton('white', changed=self.on_change) self.layout().addRow("Text Color", self.text_color) self.text_font = FontButton('Impact', 32, changed=self.on_change) self.layout().addRow("Text Font", self.text_font) # Background Boxes self.text_bg_color = ColorButton('black', changed=self.on_change) self.layout().addRow('Text Background', self.text_bg_color) self.top_bg_height = qtw.QSpinBox( minimum=0, maximum=32, valueChanged=self.on_change, suffix=' line(s)') self.layout().addRow('Top BG height', self.top_bg_height) self.bottom_bg_height = qtw.QSpinBox( minimum=0, maximum=32, valueChanged=self.on_change, suffix=' line(s)') self.layout().addRow('Bottom BG height', self.bottom_bg_height) self.bg_padding = qtw.QSpinBox( minimum=0, maximum=100, value=10, valueChanged=self.on_change, suffix=' px') self.layout().addRow('BG Padding', self.bg_padding) # Deep Fryer self.deep_fry = qtw.QCheckBox('Deep Fry', stateChanged=self.on_change) self.layout().addRow(self.deep_fry)
Example #26
Source File: question_8_answer.py From Mastering-GUI-Programming-with-Python with MIT License | 5 votes |
def __init__(self): """MainWindow constructor. This widget will be our main window. We'll define all the UI components in here. """ super().__init__() # Main UI code goes here widgets = [ qtw.QLabel("I am a label"), qtw.QLineEdit(placeholderText="I am a line edit"), qtw.QSpinBox(), qtw.QCheckBox("I am a checkbox"), qtw.QComboBox(editable=True) ] container = qtw.QWidget() self.setCentralWidget(container) container.setLayout(qtw.QVBoxLayout()) for widget in widgets: container.layout().addWidget(widget) # Style switching combobox styles = qtw.QStyleFactory.keys() style_combo = qtw.QComboBox() style_combo.addItems(styles) style_combo.currentTextChanged.connect(self.set_style) container.layout().addWidget(style_combo) # End main UI code self.show()
Example #27
Source File: treeview_model.py From CvStudio with MIT License | 5 votes |
def createEditor(self, parent: QWidget, option: QStyleOptionViewItem, index: QtCore.QModelIndex) -> QWidget: editor = QSpinBox(parent) editor.setFrame(False) editor.setMinimum(0) editor.setMaximum(100) return editor
Example #28
Source File: localize.py From picasso with MIT License | 5 votes |
def __init__(self, window): super().__init__(window) self.window = window self.setWindowTitle("Contrast") self.resize(200, 0) self.setModal(False) grid = QtWidgets.QGridLayout(self) black_label = QtWidgets.QLabel("Black:") grid.addWidget(black_label, 0, 0) self.black_spinbox = QtWidgets.QSpinBox() self.black_spinbox.setKeyboardTracking(False) self.black_spinbox.setRange(0, 999999) self.black_spinbox.valueChanged.connect(self.on_contrast_changed) grid.addWidget(self.black_spinbox, 0, 1) white_label = QtWidgets.QLabel("White:") grid.addWidget(white_label, 1, 0) self.white_spinbox = QtWidgets.QSpinBox() self.white_spinbox.setKeyboardTracking(False) self.white_spinbox.setRange(0, 999999) self.white_spinbox.valueChanged.connect(self.on_contrast_changed) grid.addWidget(self.white_spinbox, 1, 1) self.auto_checkbox = QtWidgets.QCheckBox("Auto") self.auto_checkbox.setTristate(False) self.auto_checkbox.setChecked(True) self.auto_checkbox.stateChanged.connect(self.on_auto_changed) grid.addWidget(self.auto_checkbox, 2, 0, 1, 2) self.silent_contrast_change = False
Example #29
Source File: nanotron.py From picasso with MIT License | 5 votes |
def update_nodes_box(self): self.window.clearLayout(self.nodes_box) self.nodes.clear() n_layers = self.n_layers.value() for layer in range(n_layers): n = QtWidgets.QSpinBox() n.resize(100, 50) n.setRange(0, 999) n.setValue(500) self.nodes.append(n) self.nodes_box.addWidget(n, 0, layer)
Example #30
Source File: new_song_ui.py From superboucle with GNU General Public License v3.0 | 5 votes |
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.setWindowModality(QtCore.Qt.WindowModal) Dialog.resize(188, 141) self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) self.buttonBox.setGeometry(QtCore.QRect(10, 100, 166, 23)) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.formLayoutWidget = QtWidgets.QWidget(Dialog) self.formLayoutWidget.setGeometry(QtCore.QRect(30, 20, 101, 61)) self.formLayoutWidget.setObjectName("formLayoutWidget") self.formLayout = QtWidgets.QFormLayout(self.formLayoutWidget) self.formLayout.setContentsMargins(0, 0, 0, 0) self.formLayout.setObjectName("formLayout") self.label = QtWidgets.QLabel(self.formLayoutWidget) self.label.setObjectName("label") self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label) self.label_2 = QtWidgets.QLabel(self.formLayoutWidget) self.label_2.setObjectName("label_2") self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_2) self.widthSpinBox = QtWidgets.QSpinBox(self.formLayoutWidget) self.widthSpinBox.setMaximum(16) self.widthSpinBox.setProperty("value", 8) self.widthSpinBox.setObjectName("widthSpinBox") self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.widthSpinBox) self.heightSpinBox = QtWidgets.QSpinBox(self.formLayoutWidget) self.heightSpinBox.setMaximum(16) self.heightSpinBox.setProperty("value", 8) self.heightSpinBox.setObjectName("heightSpinBox") self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.heightSpinBox) self.retranslateUi(Dialog) self.buttonBox.accepted.connect(Dialog.accept) self.buttonBox.rejected.connect(Dialog.reject) QtCore.QMetaObject.connectSlotsByName(Dialog)