|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import sys
class lineEditDemo(QWidget):
def __init__(self, sellina):
super(lineEditDemo).__init__(sellina)
self.setWindowTitle("标题")
flo = QFormLayout()
pIPLineEdit = QLineEdit()
pMACLineEdit = QLineEdit()
pDateLineEdit = QLineEdit()
pLiceseLineEdit = QLineEdit()
flo.addRow("数字掩码", pIPLineEdit)
flo.addRow("Mac掩码", pMACLineEdit)
flo.addRow("日期掩码", pDateLineEdit)
flo.addRow("许可证掩码", pLiceseLineEdit)
#显示效果
pIPLineEdit.setInputMask("000.000.000.000;_")
pMACLineEdit.setInputMask("HH:HH:HH:HH:HH:HH;_")
pDateLineEdit.setInputMask("0000-00-00")
pLiceseLineEdit.setInputMask(">AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#")
self.setLayout(flo)
if __name__ == '__main__':
app = QApplication(sys.argv)
win = lineEditDemo()
win.show()
sys.exit(app.exec_())
- from PyQt5.QtWidgets import *
- from PyQt5.QtCore import *
- from PyQt5.QtGui import *
- import sys
- class lineEditDemo(QWidget):
- def __init__(self, parent=None):
- super(lineEditDemo,self).__init__(parent)
- self.setWindowTitle("标题")
- flo = QFormLayout()
- pIPLineEdit = QLineEdit()
- pMACLineEdit = QLineEdit()
- pDateLineEdit = QLineEdit()
- pLiceseLineEdit = QLineEdit()
- flo.addRow("数字掩码", pIPLineEdit)
- flo.addRow("Mac掩码", pMACLineEdit)
- flo.addRow("日期掩码", pDateLineEdit)
- flo.addRow("许可证掩码", pLiceseLineEdit)
- #显示效果
- pIPLineEdit.setInputMask("000.000.000.000;_")
- pMACLineEdit.setInputMask("HH:HH:HH:HH:HH:HH;_")
- pDateLineEdit.setInputMask("0000-00-00")
- pLiceseLineEdit.setInputMask(">AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#")
- self.setLayout(flo)
- if __name__ == '__main__':
- app = QApplication(sys.argv)
- win = lineEditDemo()
- win.show()
- sys.exit(app.exec_())
复制代码
|
-
|