from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
app = QApplication(list())
line = QLineEdit()
font = line.font()
font.setPointSize(9)
line.setFont(font)
fm = QFontMetrics(line.font())
line.setFixedHeight(fm.height())
line.show()
app.exec_()