Python Qt 和多行 qlabel

标签 python qt pyqt styles

我想在同一个 qlabel 中获得 rss feed 的结果。这是我的标签

Title = QLabel("Title: %s " % (title.text), self)
desc = QLabel("Summary: %s " % (desc.text), self)

这是我当前的布局

    h_splitter1 = QSplitter(Qt.Horizontal, self)
    h_splitter1.addWidget(Title)
    h_splitter1.addWidget(Desc)

截至目前,它显示在单独的拆分框中。我怎样才能将它们组合起来,使它们像这样显示:

Title: Price, Sox look forward to re-setting Tuesday
Desc: Red Sox ace David Price had no issue with Monday's "coldout" in Cleveland. Roughly an hour after the decision had been made to postpone Opening Day until Tuesday at 1:10 p.m. ET, Price still had numbness in his throwing hand -- and that was just from playing catch for five minutes.

第二个问题是我怎样才能将 DES 包裹在分线盒中?假设在 x 个字符处转到新行。

最佳答案

desc = QLabel("Title: %s\nSummary: %s " % (title.text, desc.text), self)

关于Python Qt 和多行 qlabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36412923/

相关文章:

python - 如何将 HTML 代码集成到 Python 脚本中?

python - NetworkX 中的边标签不正确

python - 有哪些适合 Python 新手(但不是编程新手)开发人员的好项目?

python - PyQt 子类化

python - 如何从 PyQt 应用程序中完全控制 Option/Alt 键?

python - 如何获取以前版本的 Python Selenium Webdriver

c++ - 根据宽度缩放 QWidget 高度

c++ - 你如何删除 Qt 中 QTableView 的行号

c++ - QMediaPlayer undefined reference 链接器错误

qt - 第一次发射信号后自动断开