猫史档案馆


【Python作品分享】不能运行代码PyQt5

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


【作品展示】

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() 
        pNormalLineEdit = QLineEdit( ) 
        pNoEchoLineEdit = QLineEdit() 
        pPasswordLineEdit = QLineEdit( ) 
        pPasswordEchoOnEditLineEdit = QLineEdit( ) 

        flo.addRow("Normal", pNormalLineEdit) 
        flo.addRow("NoEcho", pNoEchoLineEdit) 
        flo.addRow("Password", pPasswordLineEdit) 
        flo.addRow("PasswordEchoOnEdit", pPasswordEchoOnEditLineEdit) 

        pNormalLineEdit.setPlaceholderText("Normal") 
        pNoEchoLineEdit.setPlaceholderText("NoEcho") 
        pPasswordLineEdit.setPlaceholderText("Password") 
        pPasswordEchoOnEditLineEdit.setPlaceholderText("PasswordEchoOnEdit") 

        # 设置显示效果
        pNormalLineEdit.setEchoMode(QLineEdit.Normal) 
        pNoEchoLineEdit.setEchoMode(QLineEdit.NoEcho) 
        pPasswordLineEdit.setEchoMode(QLineEdit.Password)        
        pPasswordEchoOnEditLineEdit.setEchoMode(QLineEdit.PasswordEchoOnEdit)

        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下一页