本文整理汇总了Python中PyQt4.QtGui.QDoubleSpinBox.setRange方法的典型用法代码示例。如果您正苦于以下问题:Python QDoubleSpinBox.setRange方法的具体用法?Python QDoubleSpinBox.setRange怎么用?Python QDoubleSpinBox.setRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QDoubleSpinBox
的用法示例。
在下文中一共展示了QDoubleSpinBox.setRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ChangeConfLevelDlg
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setRange [as 别名]
class ChangeConfLevelDlg(QDialog):
''' Dialog for changing confidence level '''
def __init__(self, previous_value=DEFAULT_CONF_LEVEL, parent=None):
super(ChangeConfLevelDlg, self).__init__(parent)
cl_label = QLabel("Global Confidence Level:")
self.conf_level_spinbox = QDoubleSpinBox()
self.conf_level_spinbox.setRange(50, 99.999 )
self.conf_level_spinbox.setSingleStep(0.1)
self.conf_level_spinbox.setSuffix(QString("%"))
self.conf_level_spinbox.setValue(previous_value)
self.conf_level_spinbox.setDecimals(1)
buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
hlayout = QHBoxLayout()
hlayout.addWidget(cl_label)
hlayout.addWidget(self.conf_level_spinbox)
vlayout = QVBoxLayout()
vlayout.addLayout(hlayout)
vlayout.addWidget(buttonBox)
self.setLayout(vlayout)
self.connect(buttonBox, SIGNAL("accepted()"), self, SLOT("accept()"))
self.connect(buttonBox, SIGNAL("rejected()"), self, SLOT("reject()"))
self.setWindowTitle("Change Confidence Level")
def get_value(self):
return self.conf_level_spinbox.value()
示例2: AbstractSnappingToleranceAction
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setRange [as 别名]
class AbstractSnappingToleranceAction(QWidgetAction):
"""Abstract action for Snapping Tolerance."""
snappingToleranceChanged = pyqtSignal(float)
def __init__(self, parent=None):
super(AbstractSnappingToleranceAction, self).__init__(parent)
self._iface = None
self._toleranceSpin = QDoubleSpinBox(parent)
self._toleranceSpin.setDecimals(5)
self._toleranceSpin.setRange(0.0, 100000000.0)
self.setDefaultWidget(self._toleranceSpin)
self.setText('Snapping Tolerance')
self.setStatusTip('Set the snapping tolerance')
self._refresh()
self._toleranceSpin.valueChanged.connect(self._changed)
def setInterface(self, iface):
self._iface = iface
self._refresh()
# Private API
def _changed(self, tolerance):
pass
def _refresh(self):
pass
示例3: _refresh_widgets_from_axistags
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setRange [as 别名]
def _refresh_widgets_from_axistags(self):
axiskeys = [tag.key for tag in self.axistags]
row_widgets = collections.OrderedDict()
for key in axiskeys:
tag_info = self.axistags[key]
resolution_box = QDoubleSpinBox(parent=self)
resolution_box.setRange(0.0, numpy.finfo(numpy.float32).max)
resolution_box.setValue( tag_info.resolution )
resolution_box.valueChanged.connect( self._update_axistags_from_widgets )
resolution_box.installEventFilter(self)
description_edit = QLineEdit(tag_info.description, parent=self)
description_edit.textChanged.connect( self._update_axistags_from_widgets )
description_edit.installEventFilter(self)
row_widgets[key] = RowWidgets( resolution_box, description_edit )
# Clean up old widgets (if any)
for row in range(self.rowCount()):
for col in range(self.columnCount()):
w = self.cellWidget( row, col )
if w:
w.removeEventFilter(self)
# Fill table with widgets
self.setRowCount( len(row_widgets) )
self.setVerticalHeaderLabels( row_widgets.keys() )
for row, widgets in enumerate(row_widgets.values()):
self.setCellWidget( row, 0, widgets.resolution_box )
self.setCellWidget( row, 1, widgets.description_edit )
示例4: initUI
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setRange [as 别名]
def initUI(self):
self.grid = QGridLayout(self)
self.setLayout(self.grid)
self.loadSettings()
self.inputLabels = [QLabel(l) for l in self.Inputs]
self.inputBoxes = []
for i, iL in enumerate(self.inputLabels):
self.grid.addWidget(iL, i, 0)
sp = QDoubleSpinBox(self)
sp.setRange(-1e10, 1e10)
sp.setKeyboardTracking(False)
self.grid.addWidget(sp, i, 1)
self.inputBoxes.append(sp)
for val, iB in zip(self.inputValues, self.inputBoxes):
iB.setValue(val)
self.connectSpinBoxes()
self.outputValues = [0.0]*len(self.Outputs)
self.outputLabels = [QLabel(l) for l in self.Outputs]
self.outputValueLabels = [QLabel('0.0') for l in self.Outputs]
sI = len(self.inputLabels)
for i, oL in enumerate(self.outputLabels):
self.grid.addWidget(oL, sI + i, 0)
self.grid.addWidget(self.outputValueLabels[i], sI + i, 1)
示例5: float_widget
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setRange [as 别名]
def float_widget(self, start_val, min_val, max_val, step):
""" Returns a float widget with the given values.
"""
box = QDoubleSpinBox()
box.setRange(min_val, max_val)
box.setValue(start_val)
box.setSingleStep(step)
return box
示例6: createDoubleSpinner
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setRange [as 别名]
def createDoubleSpinner(self, minimum, maximum):
spinner = QDoubleSpinBox()
spinner.setEnabled(False)
spinner.setMinimumWidth(75)
spinner.setRange(minimum, maximum)
spinner.setKeyboardTracking(False)
spinner.editingFinished.connect(self.spinning)
spinner.valueChanged.connect(self.spinning)
return spinner
示例7: __createDoubleSpinner
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setRange [as 别名]
def __createDoubleSpinner(self):
spinner = QDoubleSpinBox()
spinner.setEnabled(False)
spinner.setMinimumWidth(75)
max = 999999999999
spinner.setRange(-max,max)
# spinner.valueChanged.connect(self.plotScalesChanged)
spinner.editingFinished.connect(self.plotScalesChanged)
return spinner
示例8: createDoubleSpinner
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setRange [as 别名]
def createDoubleSpinner(self, minimum, maximum):
spinner = QDoubleSpinBox()
spinner.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
spinner.setMinimumWidth(105)
spinner.setRange(minimum, maximum)
spinner.setKeyboardTracking(False)
spinner.setDecimals(8)
spinner.editingFinished.connect(self.plotScaleChanged)
spinner.valueChanged.connect(self.plotScaleChanged)
return spinner
示例9: createEditor
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setRange [as 别名]
def createEditor( self, parent, _option, index ):
if index.column() == ABONO:
spinbox = QDoubleSpinBox( parent )
max = index.model().lines[index.row()].totalFac
spinbox.setRange( 0.0001, max )
spinbox.setDecimals( 4 )
spinbox.setSingleStep( 1 )
spinbox.setAlignment( Qt.AlignRight | Qt.AlignVCenter )
return spinbox
else:
None
示例10: widgetByType
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setRange [as 别名]
def widgetByType(self, valueType):
if isinstance(valueType, str):
valPieces = valueType.lower().split(":")
typeStr = valPieces[0]
rngMin = "min"
rngMax = "max"
if len(valPieces) == 3:
rngMin = valPieces[1] if valPieces[1] != "" else "min"
rngMax = valPieces[2] if valPieces[2] != "" else "max"
if typeStr == "float":
box = QDoubleSpinBox(self)
if rngMin == "min":
rngMin = -2000000000.
else:
rngMin = float(rngMin)
if rngMax == "max":
rngMax = 2000000000.
else:
rngMax = float(rngMax)
box.setRange(rngMin, rngMax)
box.setDecimals(10)
return box
elif typeStr == "int":
box = QSpinBox(self)
if rngMin == "min":
rngMin = -2**31 + 1
else:
rngMin = int(rngMin)
if rngMax == "max":
rngMax = 2**31 - 1
else:
rngMax = int(rngMax)
box.setRange(rngMin, rngMax)
return box
elif typeStr == "str":
return QLineEdit(self)
elif typeStr == "bool":
return QCheckBox(self)
elif isinstance(valueType, list):
box = QComboBox(self)
for item in valueType:
box.addItem(item)
return box
示例11: Form
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setRange [as 别名]
class Form(QDialog):
def __init__(self, parent=None):
super(Form, self).__init__(parent)
self.label_amount = QLabel('Amount')
self.spin_amount = QDoubleSpinBox()
self.spin_amount.setRange(0, 10000000000)
self.spin_amount.setPrefix('Rp. ')
self.spin_amount.setSingleStep(100000)
self.label_rate = QLabel('Rate')
self.spin_rate = QDoubleSpinBox()
self.spin_rate.setSuffix(' %')
self.spin_rate.setSingleStep(0.1)
self.spin_rate.setRange(0, 100)
self.label_year = QLabel('Years')
self.spin_year = QSpinBox()
self.spin_year.setSuffix(' year')
self.spin_year.setSingleStep(1)
self.spin_year.setRange(0, 1000)
self.spin_year.setValue(1)
self.label_total_ = QLabel('Total')
self.label_total = QLabel('Rp. 0.00')
grid = QGridLayout()
grid.addWidget(self.label_amount, 0, 0)
grid.addWidget(self.spin_amount, 0, 1)
grid.addWidget(self.label_rate, 1, 0)
grid.addWidget(self.spin_rate, 1, 1)
grid.addWidget(self.label_year, 2, 0)
grid.addWidget(self.spin_year, 2, 1)
grid.addWidget(self.label_total_, 3, 0)
grid.addWidget(self.label_total, 3, 1)
self.setLayout(grid)
self.connect(self.spin_amount, SIGNAL('valueChanged(double)'), self.update_ui)
self.connect(self.spin_rate, SIGNAL('valueChanged(double)'), self.update_ui)
self.connect(self.spin_year, SIGNAL('valueChanged(int)'), self.update_ui)
self.setWindowTitle('Interest')
def update_ui(self):
amount = self.spin_amount.value()
rate = self.spin_rate.value()
year = self.spin_year.value()
total = amount * (1 + rate / 100.0) ** year
self.label_total.setText('Rp. %.2f' % total)
示例12: add_layer
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setRange [as 别名]
def add_layer(self):
i = self.dlg.table.rowCount()
self.dlg.table.insertRow(i)
layer = QgsMapLayerComboBox()
layer.setFilters(QgsMapLayerProxyModel.RasterLayer)
band = QTableWidgetItem('1')
band.setFlags(Qt.ItemIsEnabled)
mean = QDoubleSpinBox()
mean.setRange(-10000.00,10000.00)
self.dlg.table.setCellWidget(i, 0, layer)
self.dlg.table.setItem(i, 1, band)
self.dlg.table.setCellWidget(i, 2, mean)
示例13: populateGuessBoxes
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setRange [as 别名]
def populateGuessBoxes(self):
self.guessBox = []
self.fitBox = []
sI = 1 # TODO: do something smart about this
for i, n in enumerate(self.fitter.parameterNames):
spGuess = QDoubleSpinBox(self)
spGuess.setRange(-1e10, 1e10)
spGuess.setKeyboardTracking(False)
spFit = QLabel('0.0')
self.parmGrid.addWidget(QLabel(n, parent=self), i+sI+1, 0)
self.parmGrid.addWidget(spGuess, i+sI+1, 1)
self.parmGrid.addWidget(spFit, i+sI+1, 2)
self.guessBox.append(spGuess)
self.fitBox.append(spFit)
self.connectGuessBoxes()
示例14: nextWidget
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setRange [as 别名]
def nextWidget(self):
self.buttonNext.setEnabled(False)
self.buttonBack.setEnabled(True)
self.stackedWidget.setCurrentIndex(1)
self.widgetExperiment.tableWidget.clear()
self.widgetExperiment.memoryEdit.clear()
self.widgetExperiment.signalEdit.clear()
self.widgetExperiment.outputEdit.clear()
self.widgetExperiment.tableWidget.setRowCount(self.widgetInputCount.spinInput.value())
self.widgetExperiment.tableWidget.setColumnCount(3)
self.widgetExperiment.tableWidget.setHorizontalHeaderLabels(['i', 'w(i)', 'x(i)'])
self.neuron = Neuron(self.widgetInputCount.spinInput.value())
for i in xrange(len(self.neuron.weights)):
spinBox1 = QDoubleSpinBox()
spinBox1.setRange(-100.0, 100.0)
spinBox2 = QDoubleSpinBox()
spinBox2.setRange(-100.0, 100.0)
self.connect(spinBox1, SIGNAL('valueChanged(double)'), self.updateResult)
self.connect(spinBox2, SIGNAL('valueChanged(double)'), self.updateResult)
self.widgetExperiment.tableWidget.setCellWidget(i, 0, QLabel(str(i + 1)))
self.widgetExperiment.tableWidget.setCellWidget(i, 1, spinBox1)
self.widgetExperiment.tableWidget.setCellWidget(i, 2, spinBox2)
示例15: Widget
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setRange [as 别名]
class Widget(QWidget):
def __init__(self, parent=None):
super(Widget, self).__init__(parent)
label = QLabel()
label.setText('The neuron that you will be examining will divide the objects you will show it into the ones\n' +
'that it likes and the ones it dislikes\n' +
'Let\'s assume that be recognized objects are flowers\n')
# groupbox1
groupBox1 = QGroupBox()
groupBox1.setTitle('Feature weight')
groupBox1Label1 = QLabel()
groupBox1Label1.setText('Here you enter the neuron\'s weight coefficients for the individual object features. Positve\n' +
'coefficient means approval to the attribute, and negative one will indicate that the given\n' +
'attribute should be disliked by the neuron.')
groupBox1Label2 = QLabel()
groupBox1Label2.setText('Now, enter if you want the neuron to like the flower that is:')
self.spinBoxWeightFragment = QDoubleSpinBox()
self.spinBoxWeightFragment.setValue(1.0)
self.spinBoxWeightFragment.setRange(-100.0, 100.0)
self.spinBoxWeightColorful = QDoubleSpinBox()
self.spinBoxWeightColorful.setValue(2.0)
self.spinBoxWeightColorful.setRange(-100.0, 100.0)
groupBox1HLayout = QHBoxLayout()
groupBox1HLayout.addWidget(QLabel('Fragment:'))
groupBox1HLayout.addWidget(self.spinBoxWeightFragment)
groupBox1HLayout.addWidget(QLabel('Colorful:'))
groupBox1HLayout.addWidget(self.spinBoxWeightColorful)
groupBox1VLayout = QVBoxLayout()
groupBox1VLayout.addWidget(groupBox1Label1)
groupBox1VLayout.addWidget(groupBox1Label2)
groupBox1VLayout.addLayout(groupBox1HLayout)
groupBox1.setLayout(groupBox1VLayout)
# groupbox2
groupBox2 = QGroupBox()
groupBox2.setTitle('Evaluated object')
self.spinBoxObjectFragment = QDoubleSpinBox()
self.spinBoxObjectFragment.setRange(-100.0, 100.0)
self.spinBoxObjectColorful = QDoubleSpinBox()
self.spinBoxObjectColorful.setRange(-100.0, 100.0)
groupBox2HLayout = QHBoxLayout()
groupBox2HLayout.addWidget(QLabel('Fragment'))
groupBox2HLayout.addWidget(self.spinBoxObjectFragment)
groupBox2HLayout.addWidget(QLabel('Colorful'))
groupBox2HLayout.addWidget(self.spinBoxObjectColorful)
groupBox2VLayout = QVBoxLayout()
groupBox2VLayout.addWidget(QLabel('After setting the weight, yout can perform experiments. Enter if the flower is:'))
groupBox2VLayout.addLayout(groupBox2HLayout)
groupBox2.setLayout(groupBox2VLayout)
# groupbox3
groupBox3 = QGroupBox()
groupBox3.setTitle('Neuron\'s response')
pushbuttonGroup3 = QPushButton('Recalculate!')
self.output = QLabel()
self.attitude = QLabel()
groupBox3HLayout1 = QHBoxLayout()
groupBox3HLayout1.addWidget(QLabel('The neuron\'s response value is:'))
groupBox3HLayout1.addWidget(self.output)
groupBox3HLayout2 = QHBoxLayout()
groupBox3HLayout2.addWidget(QLabel('It means that the neuron\'s attitude against the flower is:'))
groupBox3HLayout2.addWidget(self.attitude)
groupBox3HLayout2.addWidget(pushbuttonGroup3)
groupBox3VLayout = QVBoxLayout()
groupBox3VLayout.addLayout(groupBox3HLayout1)
groupBox3VLayout.addLayout(groupBox3HLayout2)
groupBox3.setLayout(groupBox3VLayout)
layout = QVBoxLayout()
layout.addWidget(label)
layout.addWidget(groupBox1)
layout.addWidget(groupBox2)
layout.addWidget(groupBox3)
self.setLayout(layout)
self.setWindowTitle('Single neuron examination (example 01a)')
self.connect(self.spinBoxWeightFragment, SIGNAL('valueChanged(double)'), self.evaluateObject)
self.connect(self.spinBoxWeightColorful, SIGNAL('valueChanged(double)'), self.evaluateObject)
self.connect(self.spinBoxObjectFragment, SIGNAL('valueChanged(double)'), self.evaluateObject)
self.connect(self.spinBoxObjectColorful, SIGNAL('valueChanged(double)'), self.evaluateObject)
self.connect(pushbuttonGroup3, SIGNAL('clicked()'), self.evaluateObject)
self.neuron = Neuron(2)
def evaluateObject(self):
self.neuron.weights[0] = self.spinBoxWeightFragment.value()
self.neuron.weights[1] = self.spinBoxWeightColorful.value()
#.........这里部分代码省略.........