![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
from PyQt5.Qt import * #刚开始学习可以这样一下导入 import sys,time class Window(QWidget): def __init__(self): super().__init__() self.setWindowTitle("QLineEdit 输出模式的案例") self.resize(400,400) self.set_ui() self.i = 1 def set_ui(self): pass def resizeEvent(self, event): widget_w = 150 widget_h = 40 widget_h_margin = 10 top_margin = 30 account_lineEdit = QLineEdit(self) account_lineEdit.resize(widget_w,widget_h) pwd_lineEdit = QLineEdit(self) pwd_lineEdit.resize(widget_w,widget_h) btn = QPushButton(self) btn.setText("按钮") btn.resize(widget_w,widget_h) x = (self.width() - widget_w)/2 -self.i y1 = top_margin y2