本文整理汇总了Python中PyQt5.QtGui.QDoubleValidator方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QDoubleValidator方法的具体用法?Python QtGui.QDoubleValidator怎么用?Python QtGui.QDoubleValidator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui
的用法示例。
在下文中一共展示了QtGui.QDoubleValidator方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: stopLoss
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QDoubleValidator [as 别名]
def stopLoss(self):
logging.debug('BinanceOrder::stopLoss() called')
self.stop_loss_input = QWidget()
self.stop_loss_layout = QVBoxLayout(self.stop_loss_input)
self.stop_loss_price_txt = QLabel()
self.stop_loss_price_txt.setText(QC.translate('', 'Stop price:'))
self.stop_loss_price_input = QLineEdit()
self.stop_loss_price_input.setValidator(QDoubleValidator(999999, -999999, 8))
self.stop_loss_params = QLabel()
self.stop_loss_params.setText(
'{\'stopPrice\' : 12.345, \'quantity\' : 0.005}')
self.stop_loss_layout.addWidget(self.stop_loss_price_txt)
self.stop_loss_layout.addWidget(self.stop_loss_price_input)
self.stop_loss_layout.addWidget(self.stop_loss_params)
self.stop_loss_layout.addStretch(1)
self.order_box.addWidget(self.stop_loss_input)
示例2: takeProfit
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QDoubleValidator [as 别名]
def takeProfit(self):
logging.debug('BinanceOrder::takeProfit() called')
self.take_profit_input = QWidget()
self.take_profit_layout = QVBoxLayout(self.take_profit_input)
self.take_profit_stop_price = QLabel()
self.take_profit_stop_price.setText(QC.translate('', 'Stop price:'))
self.take_profit_stop_price_input = QLineEdit()
self.take_profit_stop_price_input.setValidator(QDoubleValidator(999999, -999999, 8))
self.take_profit_params = QLabel()
self.take_profit_params.setText(
'{\'stopPrice\': 12.345, \'quantity\' : 0.005}')
self.take_profit_layout.addWidget(self.take_profit_stop_price)
self.take_profit_layout.addWidget(self.take_profit_stop_price_input)
self.take_profit_layout.addWidget(self.take_profit_params)
self.take_profit_layout.addStretch(1)
self.order_box.addWidget(self.take_profit_input)
示例3: createEditor
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QDoubleValidator [as 别名]
def createEditor(self, parent, option, index):
widget = QtWidgets.QLineEdit(parent)
widget.setAlignment(QtCore.Qt.AlignRight)
validator = QtGui.QDoubleValidator(self)
locale = QtCore.QLocale("en")
validator.setLocale(locale)
widget.setValidator(validator)
return widget
示例4: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QDoubleValidator [as 别名]
def __init__(self, *args, **kwargs):
"""
Initialize the float input field.
"""
super().__init__(*args, **kwargs)
self.setAttribute(QtCore.Qt.WA_MacShowFocusRect, 0)
self.setValidator(QtGui.QDoubleValidator(self))
示例5: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QDoubleValidator [as 别名]
def __init__(self):
super(MainWindow,self).__init__()
self.slide = FloatSlider(QtCore.Qt.Vertical)
self.slide.setRange(-12.,10.,400)
self.slide.valueChanged.connect(self.onSlide)
self.slide.floatValueChanged.connect(self.onSlideFloat)
self.slide.setValue(7.)
self.setWindowTitle("Key Frame View")
self.edit = QtWidgets.QLineEdit("")
self.edit.setValidator(QtGui.QDoubleValidator())
self.edit.returnPressed.connect(lambda: self.slide.setValue(float(self.edit.text())))
self.slide.floatValueChanged.connect(lambda x: self.edit.setText(str(x)))
self.resize(500,200)
hbox = QtWidgets.QHBoxLayout()
hbox.addWidget(self.slide)
hbox.addWidget(self.edit)
self.setLayout(hbox)
# self.setStyleSheet("""
# background-color:black;
# color:black;""")
示例6: limitOrder
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QDoubleValidator [as 别名]
def limitOrder(self):
logging.debug('BinanceOrder::limitOrder() called')
self.limit_input = QWidget()
self.limit_layout = QVBoxLayout(self.limit_input)
self.limit_time_in_force_txt = QLabel()
self.limit_time_in_force_txt.setText(QC.translate('', 'Time in force:'))
self.limit_time_in_force_input = QComboBox()
self.limit_time_in_force_input.addItem(QC.translate('',
'Good til canceled'), QVariant('GTC'))
self.limit_time_in_force_input.addItem(QC.translate('',
'Immediate or Cancel'), QVariant('IOC'))
self.limit_time_in_force_input.addItem(QC.translate('', 'Fill or Kill'), QVariant('FOK'))
self.limit_price_txt = QLabel()
self.limit_price_txt.setText(QC.translate('', 'Limit price:'))
self.limit_price_input = QLineEdit()
self.limit_price_input.setValidator(QDoubleValidator(999999, -999999, 8))
self.limit_input_params = QLabel()
self.limit_input_params.setText(
'{\'price\' : 12.345, \'quantity\' : 0.005, \'type\' : \'GTC\'/\'IOC\'/\'FOK\'}')
self.limit_layout.addWidget(self.limit_time_in_force_txt)
self.limit_layout.addWidget(self.limit_time_in_force_input)
self.limit_layout.addWidget(self.limit_price_txt)
self.limit_layout.addWidget(self.limit_price_input)
self.limit_layout.addWidget(self.limit_input_params)
self.order_box.addWidget(self.limit_input)
示例7: to_widget
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QDoubleValidator [as 别名]
def to_widget(self, opt):
return GStringLineEditor.to_widget(self, opt,
validator=QtGui.QDoubleValidator())
示例8: select_type_validator
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QDoubleValidator [as 别名]
def select_type_validator(tp: click.types.ParamType)-> QtGui.QValidator:
""" select the right validator for `tp`"""
if isinstance(tp, click.types.IntParamType):
return QtGui.QIntValidator()
elif isinstance(tp, click.types.FloatParamType):
return QtGui.QDoubleValidator()
return None
示例9: initUI
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QDoubleValidator [as 别名]
def initUI(self):
if self.proc is None:
return
# def createStandardCheckbox(parent, img1=None , img2 = None, tooltip = ""):
vbox = QtWidgets.QVBoxLayout()
gridBox = QtWidgets.QGridLayout()
self.checkActive = gui_utils.createImageCheckbox(self,
absPath("images/icon_processor_active"),
absPath("images/icon_processor_inactive"))
label = QtWidgets.QLabel(self.proc.name)
gridBox.addWidget(self.checkActive,0,0)
gridBox.addWidget(label,0,1)
for i, (key, val) in enumerate(six.iteritems(self.proc.kwargs)):
dtype = type(val)
if dtype == bool:
check = QtWidgets.QCheckBox("",self)
check.stateChanged.connect(self.set_proc_attr_check(check,key,val))
gridBox.addWidget(QtWidgets.QLabel(key),i+1,0)
gridBox.addWidget(check,i+1,1)
elif dtype in (int,float,np.int,np.float):
edit = QtWidgets.QLineEdit(str(val))
edit.setValidator(QtGui.QDoubleValidator())
edit.returnPressed.connect(self.set_proc_attr_edit(edit,key,dtype))
gridBox.addWidget(QtWidgets.QLabel(key),i+1,0)
gridBox.addWidget(edit,i+1,1)
vbox.addLayout(gridBox)
vbox.addStretch()
self.setLayout(vbox)
self.setSizePolicy(Qt.QSizePolicy.Minimum,Qt.QSizePolicy.Minimum)
self.setStyleSheet("""
QFrame,QLabel,QLineEdit {
color: white;
}
""")
self.checkActive.stateChanged.connect(lambda x:self._stateChanged.emit(x!=0))
# self._stateChanged.connect(self.foo)
示例10: stopLossLimit
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QDoubleValidator [as 别名]
def stopLossLimit(self):
logging.debug('BinanceOrder::stopLossLimit() called')
self.stop_loss_limit_input = QWidget()
self.stop_loss_limit_layout = QVBoxLayout(self.stop_loss_limit_input)
self.stop_loss_limit_time_in_force_txt = QLabel()
self.stop_loss_limit_time_in_force_txt.setText(QC.translate('', 'Time in force:'))
self.stop_loss_limit_time_in_force_input = QComboBox()
self.stop_loss_limit_time_in_force_input.addItem(QC.translate('',
'Good til canceled'), QVariant('GTC'))
self.stop_loss_limit_time_in_force_input.addItem(QC.translate('',
'Immediate or Cancel'), QVariant('IOC'))
self.stop_loss_limit_time_in_force_input.addItem(QC.translate('',
'Fill or Kill'), QVariant('FOK'))
self.stop_loss_limit_price_txt = QLabel()
self.stop_loss_limit_price_txt.setText(QC.translate('', 'Price:'))
self.stop_loss_limit_price_input = QLineEdit()
self.stop_loss_limit_price_input.setValidator(QDoubleValidator(999999, -999999, 8))
self.stop_loss_limit_stop_price_txt = QLabel()
self.stop_loss_limit_stop_price_txt.setText(QC.translate('', 'Stop price:'))
self.stop_loss_limit_stop_price_input = QLineEdit()
self.stop_loss_limit_stop_price_input.setValidator(QDoubleValidator(999999, -999999, 8))
self.stop_loss_limit_params = QLabel()
self.stop_loss_limit_params.setText(
'{\'price\' : 12.345, \'stopPrice\': 12.345, \'quantity\' : 0.005, \'type\' : \'GTC\'/\'IOC\'/\'FOK\'}')
self.stop_loss_limit_layout.addWidget(self.stop_loss_limit_time_in_force_txt)
self.stop_loss_limit_layout.addWidget(self.stop_loss_limit_time_in_force_input)
self.stop_loss_limit_layout.addWidget(self.stop_loss_limit_price_txt)
self.stop_loss_limit_layout.addWidget(self.stop_loss_limit_price_input)
self.stop_loss_limit_layout.addWidget(self.stop_loss_limit_stop_price_txt)
self.stop_loss_limit_layout.addWidget(self.stop_loss_limit_stop_price_input)
self.stop_loss_limit_layout.addWidget(self.stop_loss_limit_params)
self.order_box.addWidget(self.stop_loss_limit_input)
示例11: takeProfitLimit
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QDoubleValidator [as 别名]
def takeProfitLimit(self):
logging.debug('BinanceOrder::takeProfitLimit() called')
self.take_profit_limit_input = QWidget()
self.take_profit_limit_layout = QVBoxLayout(self.take_profit_limit_input)
self.take_profit_limit_time_in_force_txt = QLabel()
self.take_profit_limit_time_in_force_txt.setText(QC.translate('', 'Time in force:'))
self.take_profit_limit_time_in_force_input = QComboBox()
self.take_profit_limit_time_in_force_input.addItem(QC.translate('',
'Good til canceled'), QVariant('GTC'))
self.take_profit_limit_time_in_force_input.addItem(QC.translate('',
'Immediate or Cancel'), QVariant('IOC'))
self.take_profit_limit_time_in_force_input.addItem(QC.translate('',
'Fill or Kill'), QVariant('FOK'))
self.take_profit_limit_price = QLabel()
self.take_profit_limit_price.setText(QC.translate('', 'Price:'))
self.take_profit_limit_price_input = QLineEdit()
self.take_profit_limit_price_input.setValidator(QDoubleValidator(999999, -999999, 8))
self.take_profit_limit_stop_price = QLabel()
self.take_profit_limit_stop_price.setText(QC.translate('', 'Stop price:'))
self.take_profit_limit_stop_price_input = QLineEdit()
self.take_profit_limit_stop_price_input.setValidator(QDoubleValidator(999999, -999999, 8))
self.take_profit_limit_params = QLabel()
self.take_profit_limit_params.setText(
'{\'price\' : 12.345, \'stopPrice\': 12.345, \'quantity\' : 0.005, \'type\' : \'GTC\'/\'IOC\'/\'FOK\'}')
self.take_profit_limit_layout.addWidget(self.take_profit_limit_time_in_force_txt)
self.take_profit_limit_layout.addWidget(self.take_profit_limit_time_in_force_input)
self.take_profit_limit_layout.addWidget(self.take_profit_limit_price)
self.take_profit_limit_layout.addWidget(self.take_profit_limit_price_input)
self.take_profit_limit_layout.addWidget(self.take_profit_limit_stop_price)
self.take_profit_limit_layout.addWidget(self.take_profit_limit_stop_price_input)
self.take_profit_limit_layout.addWidget(self.take_profit_limit_params)
self.order_box.addWidget(self.take_profit_limit_input)