本文整理汇总了Python中PyQt4.QtGui.QLineEdit方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QLineEdit方法的具体用法?Python QtGui.QLineEdit怎么用?Python QtGui.QLineEdit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui
的用法示例。
在下文中一共展示了QtGui.QLineEdit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initUI
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QLineEdit [as 别名]
def initUI(self):
grid = QtGui.QGridLayout()
grid.addWidget(QtGui.QLabel(u'过滤规则:', parent=self), 0, 0, 1, 1)
self.filter = QtGui.QLineEdit(parent=self)
grid.addWidget(self.filter, 0, 1, 1, 1)
# 创建ButtonBox,用户确定和取消
buttonBox = QtGui.QDialogButtonBox(parent=self)
buttonBox.setOrientation(QtCore.Qt.Horizontal) # 设置为水平方向
buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) # 确定和取消两个按钮
# 连接信号和槽
buttonBox.accepted.connect(self.accept) # 确定
buttonBox.rejected.connect(self.reject) # 取消
# 垂直布局,布局表格及按钮
layout = QtGui.QVBoxLayout()
# 加入前面创建的表格布局
layout.addLayout(grid)
# 放一个间隔对象美化布局
spacerItem = QtGui.QSpacerItem(20, 48, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
layout.addItem(spacerItem)
# ButtonBox
layout.addWidget(buttonBox)
self.setLayout(layout)
示例2: __init__
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QLineEdit [as 别名]
def __init__(self, ecuscanner):
super(Ecu_finder, self).__init__()
self.ecuscanner = ecuscanner
layoutv = widgets.QVBoxLayout()
layouth = widgets.QHBoxLayout()
self.setLayout(layoutv)
layoutv.addLayout(layouth)
self.ecuaddr = widgets.QLineEdit()
self.ecuident = widgets.QLineEdit()
layouth.addWidget(widgets.QLabel("Addr :"))
layouth.addWidget(self.ecuaddr)
layouth.addWidget(widgets.QLabel("ID frame :"))
layouth.addWidget(self.ecuident)
button = widgets.QPushButton("VALIDATE")
layouth.addWidget(button)
button.clicked.connect(self.check)
示例3: addTextEdit
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QLineEdit [as 别名]
def addTextEdit(self, text, readOnly=True, startsVisible=True, oneLine=False):
if oneLine:
textEdit = QtGui.QLineEdit()
else:
textEdit = QtGui.QTextEdit()
load_css_for_widget(textEdit, os.path.join(css_path, 'textedit.css'))
if readOnly:
textEdit.setText(text)
else:
textEdit.setPlaceholderText(text)
textEdit.setReadOnly(readOnly)
textEdit.setGeometry(100, 100, 800, 600)
textEdit.setVisible(startsVisible)
return textEdit
示例4: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QLineEdit [as 别名]
def setupUi(self, MemoEdit):
'''被memoedit调用'''
MemoEdit.setFixedWidth(400)
'''初始化组件'''
self.titleEdit = QtGui.QLineEdit()
self.timeEdit = QtGui.QDateTimeEdit()
self.contentEdit = QtGui.QTextEdit()
self.okBtn = QtGui.QPushButton(_fromUtf8("确定"))
self.layout = QtGui.QVBoxLayout()
'''设置组件大小属性'''
self.layout.setMargin(0)
self.layout.setSpacing(0)
''' 设置stylesheet'''
'''设置布局'''
self.layout.addWidget(self.titleEdit)
self.layout.addWidget(self.timeEdit)
self.layout.addWidget(self.contentEdit)
self.layout.addWidget(self.okBtn)
self.setLayout(self.layout)
示例5: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QLineEdit [as 别名]
def setupUi(self, VarcharProperty):
VarcharProperty.setObjectName(_fromUtf8("VarcharProperty"))
VarcharProperty.resize(246, 67)
self.formLayout = QtGui.QFormLayout(VarcharProperty)
self.formLayout.setObjectName(_fromUtf8("formLayout"))
self.label = QtGui.QLabel(VarcharProperty)
self.label.setObjectName(_fromUtf8("label"))
self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.label)
self.edtCharLen = QtGui.QLineEdit(VarcharProperty)
self.edtCharLen.setObjectName(_fromUtf8("edtCharLen"))
self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.edtCharLen)
self.buttonBox = QtGui.QDialogButtonBox(VarcharProperty)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.formLayout.setWidget(1, QtGui.QFormLayout.SpanningRole, self.buttonBox)
self.retranslateUi(VarcharProperty)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), VarcharProperty.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), VarcharProperty.reject)
QtCore.QMetaObject.connectSlotsByName(VarcharProperty)
示例6: __init__
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QLineEdit [as 别名]
def __init__(self):
super(NikeSetTiming, self).__init__()
self.setWindowModality(QtCore.Qt.ApplicationModal)
self.setWindowTitle('定时设置')
# self.setFixedSize(500, 400)
self.timer = None
label_start_time = QtGui.QLabel('开始时间')
current_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
self.line = QtGui.QLineEdit(current_time)
self.time_label = QtGui.QLabel('剩余时间')
self.time_label.setFixedSize(200, 20)
self.button_confirm = QtGui.QPushButton('确定')
self.button_confirm.clicked.connect(self.add_timing)
grid = QtGui.QGridLayout()
# 组件间的间距为10
grid.setSpacing(10)
grid.addWidget(label_start_time, 1, 0)
grid.addWidget(self.line, 1, 1)
grid.addWidget(self.time_label, 2, 0)
grid.addWidget(self.button_confirm, 2, 1)
self.setLayout(grid)
# 创建计时器
示例7: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QLineEdit [as 别名]
def setupUi(self, Dialog):
Dialog.setObjectName(_fromUtf8("Dialog"))
Dialog.resize(400, 300)
self.pushButton = QtGui.QPushButton(Dialog)
self.pushButton.setGeometry(QtCore.QRect(250, 140, 75, 23))
self.pushButton.setObjectName(_fromUtf8("pushButton"))
self.lineEdit = QtGui.QLineEdit(Dialog)
self.lineEdit.setGeometry(QtCore.QRect(50, 140, 191, 20))
self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
self.label = QtGui.QLabel(Dialog)
self.label.setGeometry(QtCore.QRect(100, 180, 201, 51))
font = QtGui.QFont()
font.setPointSize(20)
self.label.setFont(font)
self.label.setObjectName(_fromUtf8("label"))
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
示例8: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QLineEdit [as 别名]
def setupUi(self, TrezorPassphraseDialog):
TrezorPassphraseDialog.setObjectName(_fromUtf8("TrezorPassphraseDialog"))
TrezorPassphraseDialog.resize(400, 133)
self.verticalLayout = QtGui.QVBoxLayout(TrezorPassphraseDialog)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.label = QtGui.QLabel(TrezorPassphraseDialog)
self.label.setObjectName(_fromUtf8("label"))
self.verticalLayout.addWidget(self.label)
self.passphraseEdit = QtGui.QLineEdit(TrezorPassphraseDialog)
self.passphraseEdit.setEchoMode(QtGui.QLineEdit.Password)
self.passphraseEdit.setObjectName(_fromUtf8("passphraseEdit"))
self.verticalLayout.addWidget(self.passphraseEdit)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem)
self.buttonBox = QtGui.QDialogButtonBox(TrezorPassphraseDialog)
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.retranslateUi(TrezorPassphraseDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), TrezorPassphraseDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), TrezorPassphraseDialog.reject)
QtCore.QMetaObject.connectSlotsByName(TrezorPassphraseDialog)
示例9: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QLineEdit [as 别名]
def setupUi(self, AddGroupDialog):
AddGroupDialog.setObjectName(_fromUtf8("AddGroupDialog"))
AddGroupDialog.resize(415, 111)
self.verticalLayout = QtGui.QVBoxLayout(AddGroupDialog)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.label = QtGui.QLabel(AddGroupDialog)
self.label.setObjectName(_fromUtf8("label"))
self.verticalLayout.addWidget(self.label)
self.newGroupEdit = QtGui.QLineEdit(AddGroupDialog)
self.newGroupEdit.setMaxLength(64)
self.newGroupEdit.setObjectName(_fromUtf8("newGroupEdit"))
self.verticalLayout.addWidget(self.newGroupEdit)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem)
self.buttonBox = QtGui.QDialogButtonBox(AddGroupDialog)
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.retranslateUi(AddGroupDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), AddGroupDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), AddGroupDialog.reject)
QtCore.QMetaObject.connectSlotsByName(AddGroupDialog)
示例10: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QLineEdit [as 别名]
def setupUi(self, ImgurClientIdDialog):
ImgurClientIdDialog.setObjectName(_fromUtf8("ImgurClientIdDialog"))
ImgurClientIdDialog.resize(754, 467)
self.gridLayout_2 = QtGui.QGridLayout(ImgurClientIdDialog)
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
self.enterClientIdBtn = QtGui.QPushButton(ImgurClientIdDialog)
self.enterClientIdBtn.setObjectName(_fromUtf8("enterClientIdBtn"))
self.gridLayout_2.addWidget(self.enterClientIdBtn, 3, 0, 1, 1)
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
self.label_2 = QtGui.QLabel(ImgurClientIdDialog)
self.label_2.setTextFormat(QtCore.Qt.RichText)
self.label_2.setOpenExternalLinks(True)
self.label_2.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse | QtCore.Qt.TextSelectableByMouse)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.horizontalLayout_2.addWidget(self.label_2)
self.gridLayout_2.addLayout(self.horizontalLayout_2, 0, 0, 1, 2)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.label = QtGui.QLabel(ImgurClientIdDialog)
self.label.setObjectName(_fromUtf8("label"))
self.horizontalLayout.addWidget(self.label)
self.clientIdLineEdit = QtGui.QLineEdit(ImgurClientIdDialog)
self.clientIdLineEdit.setObjectName(_fromUtf8("clientIdLineEdit"))
self.horizontalLayout.addWidget(self.clientIdLineEdit)
self.gridLayout_2.addLayout(self.horizontalLayout, 2, 0, 1, 2)
self.enterLaterBtn = QtGui.QPushButton(ImgurClientIdDialog)
self.enterLaterBtn.setObjectName(_fromUtf8("enterLaterBtn"))
self.gridLayout_2.addWidget(self.enterLaterBtn, 3, 1, 1, 1)
self.retranslateUi(ImgurClientIdDialog)
QtCore.QMetaObject.connectSlotsByName(ImgurClientIdDialog)
示例11: add_teams
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QLineEdit [as 别名]
def add_teams(self, overall_layout):
self.teams = []
for i in range(4):
team = (
team_name,
team_score,
team_plus,
team_minus
) = (
QtGui.QLineEdit(),
QtGui.QLineEdit(""),
QtGui.QPushButton("+"),
QtGui.QPushButton("-")
)
self.teams.append(team)
layout = QtGui.QHBoxLayout()
for widget in team:
layout.addWidget(widget)
overall_layout.addLayout(layout)
def set_team_name(new_name, n_team=i, team_name=team_name, team_score=team_score):
self.send_command("name", n_team, unicode(team_name.text()))
if not team_name.styleSheet():
self.send_command("COLOURS?")
def set_team_score(new_score, n_team=i):
self.send_command("SCORE", str(n_team), str(new_score))
def set_team_plus(n_team=i, team_score=team_score):
score = 1 + int(team_score.text() or 0)
team_score.setText(str(score))
def set_team_minus(n_team=i, team_score=team_score):
score = int(team_score.text() or 0) - 1
team_score.setText(str(score))
team_name.textEdited.connect(set_team_name)
team_score.textChanged.connect(set_team_score)
team_plus.pressed.connect(set_team_plus)
team_minus.pressed.connect(set_team_minus)
示例12: add_controller
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QLineEdit [as 别名]
def add_controller(self, overall_layout):
command_label = QtGui.QLabel("Command")
self.command = QtGui.QLineEdit()
self.send = QtGui.QPushButton("&Send")
controller_layout = QtGui.QHBoxLayout()
controller_layout.addWidget(command_label)
controller_layout.addWidget(self.command)
controller_layout.addWidget(self.send)
overall_layout.addLayout(controller_layout)
self.send.clicked.connect(self.send_command)
self.responses = QtGui.QLabel()
responses_layout = QtGui.QHBoxLayout()
responses_layout.addWidget(self.responses)
overall_layout.addLayout(responses_layout)
示例13: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QLineEdit [as 别名]
def setupUi(self, SavestatesDialog):
SavestatesDialog.setObjectName(_fromUtf8("SavestatesDialog"))
SavestatesDialog.resize(630, 600)
SavestatesDialog.setWindowTitle(QtGui.QApplication.translate("SavestatesDialog", "Unsupported game savestates", None, QtGui.QApplication.UnicodeUTF8))
self.verticalLayout = QtGui.QVBoxLayout(SavestatesDialog)
self.verticalLayout.setContentsMargins(2, 0, 2, 6)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.label = QtGui.QLabel(SavestatesDialog)
self.label.setText(QtGui.QApplication.translate("SavestatesDialog", "Filter:", None, QtGui.QApplication.UnicodeUTF8))
self.label.setObjectName(_fromUtf8("label"))
self.horizontalLayout.addWidget(self.label)
self.uiFilterLineEdit = QtGui.QLineEdit(SavestatesDialog)
self.uiFilterLineEdit.setText(_fromUtf8(""))
self.uiFilterLineEdit.setObjectName(_fromUtf8("uiFilterLineEdit"))
self.horizontalLayout.addWidget(self.uiFilterLineEdit)
self.verticalLayout.addLayout(self.horizontalLayout)
self.uiSavestatesTblv = QtGui.QTableView(SavestatesDialog)
self.uiSavestatesTblv.setObjectName(_fromUtf8("uiSavestatesTblv"))
self.verticalLayout.addWidget(self.uiSavestatesTblv)
self.uiButtonBox = QtGui.QDialogButtonBox(SavestatesDialog)
self.uiButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.uiButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.uiButtonBox.setObjectName(_fromUtf8("uiButtonBox"))
self.verticalLayout.addWidget(self.uiButtonBox)
self.retranslateUi(SavestatesDialog)
QtCore.QObject.connect(self.uiButtonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), SavestatesDialog.accept)
QtCore.QObject.connect(self.uiButtonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), SavestatesDialog.reject)
QtCore.QMetaObject.connectSlotsByName(SavestatesDialog)
SavestatesDialog.setTabOrder(self.uiFilterLineEdit, self.uiSavestatesTblv)
SavestatesDialog.setTabOrder(self.uiSavestatesTblv, self.uiButtonBox)
示例14: __init__
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QLineEdit [as 别名]
def __init__(self, num, alpha):
widgets.QLineEdit.__init__(self)
if not alpha:
self.setInputMask("H" * num)
else:
self.setInputMask("N" * num)
示例15: _addTraceSelectorIndicator
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QLineEdit [as 别名]
def _addTraceSelectorIndicator(self,Form,sizePolicy,TraceSelector = "", TraceIndicator="", prefix = "Trace: "):
self.TraceSelIndLayout = QtGui.QVBoxLayout()
self.TraceSelIndLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
self.TraceSelIndLayout.setObjectName(_fromUtf8("TraceSelIndLayout"))
self.TraceSelIndLayout.setContentsMargins(0,0,0,0)
self.TraceSelIndLayout.setContentsMargins(QtCore.QMargins(0,0,0,0))
self.TraceSelIndLayout.setSpacing(1)
setattr(self,TraceSelector,QtGui.QSpinBox(Form))
temp_SelInd = getattr(self,TraceSelector)
temp_SelInd.setSizePolicy(sizePolicy)
temp_SelInd.setSuffix(_fromUtf8(""))
temp_SelInd.setMinimum(-99999)
temp_SelInd.setMaximum(99999)
temp_SelInd.setProperty("value", -1)
temp_SelInd.setObjectName(_fromUtf8(TraceSelector))
temp_SelInd.setPrefix(_translate("Form", prefix , None))
self.TraceSelIndLayout.addWidget(temp_SelInd)
setattr(self,TraceIndicator,QtGui.QLineEdit(Form))
temp_SelInd = getattr(self,TraceIndicator)
temp_SelInd.setSizePolicy(sizePolicy)
temp_SelInd.setReadOnly(False)
temp_SelInd.setObjectName(_fromUtf8("TraceValue"))
self.TraceSelIndLayout.addWidget(temp_SelInd)
self.horizontalLayout.addLayout(self.TraceSelIndLayout,stretch = -10)