PyQt5--QLineEdit

发布时间:2019-03-12 23:11:42编辑:auto阅读(1977)

     1 # -*- coding:utf-8 -*-
     2 '''
     3 Created on Sep 20, 2018
     4 
     5 @author: SaShuangYiBing
     6 
     7 Comment: 
     8 '''
     9 import sys
    10 from PyQt5.QtWidgets import QApplication,QWidget,QLabel,QLineEdit
    11 
    12 class New_test(QWidget):
    13     def __init__(self):
    14         super().__init__()
    15         self.initUI()
    16     
    17     def initUI(self):
    18         self.lbl = QLabel(self)
    19         qle = QLineEdit(self)
    20         qle.move(60,100)
    21         self.lbl.move(60,40)
    22         
    23         qle.textChanged.connect(self.onChange)
    24         
    25         self.setGeometry(300,300,280,170)
    26         self.setWindowTitle('QLineEdit')
    27         self.show()
    28         
    29     def onChange(self,text):
    30         self.lbl.setText(text)
    31         self.lbl.adjustSize()
    32         
    33 if __name__ == '__main__':
    34     app = QApplication(sys.argv)
    35     ex = New_test()
    36     sys.exit(app.exec_())

     

     

关键字

上一篇: PyQt5--QSplitter

下一篇: PyQt5--QPixmap