【发布时间】:2016-08-16 09:34:43
【问题描述】:
我希望文本自动适应标签内。 随着 QLabel 的宽度越来越窄,文本格式会占据多行。本质上,我正在寻找一种方法来格式化它,就像我们调整网络浏览器窗口大小时格式化 html 文本一样。
label=QtGui.QLabel()
text = "Somewhere over the rainbow Way up high And the dreams that you dreamed of Once in a lullaby"
label.setText(text)
label.show()
【问题讨论】:
-
你试过 label.setWordWrap(True) 吗?