猫史档案馆


【Python作品分享】新的作品

用户:姚国栋udn0姚国栋udn0查看:0 回复:0 评论:0 创建时间:2024-01-16T16:42:25


【作品展示】

center_image

 

【作品介绍】

PyQt5可以运行的代码

 

【作品源代码】

from PyQt5.QtWidgets import QApplication,QLineEdit,QWidget,QFormLayout      
import sys  

class lineEditDemo(QWidget):
    def __init__(self,parent=None):
        super(lineEditDemo,self).__init__(parent) 
        self.setWindowTitle("QLineEdit 的输入掩码例子") 

        flo = QFormLayout() 
        pIPLineEdit = QLineEdit() 
        pMACLineEdit = QLineEdit() 
        pDateLineEdit = QLineEdit() 
        pLicenseLineEdit = QLineEdit() 

        pIPLineEdit.setInputMask("000.000.000.000;_") 
        pMACLineEdit.setInputMask("HH:HH:HH:HH:HH:HH;_") 
        pDateLineEdit.setInputMask("0000-00-00") 
        pLicenseLineEdit.setInputMask(">AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#") 

        flo.addRow("数字掩码",pIPLineEdit) 
        flo.addRow("Mac掩码",pMACLineEdit) 
        flo.addRow("日期掩码",pDateLineEdit) 
        flo.addRow("许可证掩码",pLicenseLineEdit) 

        self.setLayout(flo) 

if __name__ == "__main__":
    app = QApplication(sys.argv) 
    win = lineEditDemo() 
    win.show() 
    sys.exit(app.exec_())  

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页