【发布时间】:2015-03-15 17:47:16
【问题描述】:
下面的代码创建了一个应用了 QSS 样式表的 QLineEdit()。
如果您展示如何使用 QSS 更改 QLineEdit 的字体大小和字体颜色,我将不胜感激。我试过font-size: 12;。但它不起作用。
from PyQt4.QtCore import *
from PyQt4.QtGui import *
app=QApplication([])
bgColor='#262626'
style="""QLineEdit{{ color: #EBEBEB; border: 0px solid black; background-color: {0}; color: #EBEBEB }} QLineEdit:hover{{ border: 1px solid #ffa02f;}}""".format(bgColor)
lineEdit=QLineEdit()
lineEdit.setText('My Line Edit')
lineEdit.setStyleSheet(style)
lineEdit.show()
sys.exit(app.exec_())
【问题讨论】:
标签: python qt pyqt font-size qtstylesheets