Python PYQT QLineEdit字体大小

时间:2015-09-01 11:35:22

标签: python pyqt

我正在使用PYQT创建表单

self.texteditor1= QtGui.QLineEdit(self) 
self.texteditor1.setFixedWidth(560)

我想知道在上面的情况下如何增加texteditor的字体大小?

2 个答案:

答案 0 :(得分:1)

尝试:

f = self.texteditor1.font()
f.setPointSize(27) # sets the size to 27
self.texteditor1.setFont(f)

答案 1 :(得分:0)

设置lineedit字体的pointSize属性。

self.texteditor1 = QtGui.QLineEdit(self)
font = self.texteditor1.font()      # lineedit current font
font.setPointSize(32)               # change it's size
self.texteditor1.setFont(font)      # set font