#๐Ÿ”’ PySide6 QtWidgets Kde System Theme?

12 messages ยท Page 1 of 1 (latest)

tranquil pewter
#

I installed PySide6 from pycharm, How do I make it obey my theme?

import sys
import random
from PySide6 import QtCore, QtWidgets, QtGui

class MyWidget(QtWidgets.QWidget):
    def __init__(self):
        super().__init__()

        self.hello = ["Hallo Welt", "Hei maailma", "Hola Mundo", "ะŸั€ะธะฒะตั‚ ะผะธั€"]

        self.button = QtWidgets.QPushButton("Click me!")
        self.text = QtWidgets.QLabel("Hello World",
                                     alignment=QtCore.Qt.AlignCenter)

        self.layout = QtWidgets.QVBoxLayout(self)
        self.layout.addWidget(self.text)
        self.layout.addWidget(self.button)

        self.button.clicked.connect(self.magic)

    @QtCore.Slot()
    def magic(self):
        self.text.setText(random.choice(self.hello))

if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    widget = MyWidget()
    widget.resize(800, 600)
    widget.show()

    sys.exit(app.exec())
frigid prismBOT
#

@tranquil pewter

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

idle edge
#

AFAIK if you install PySide6 in a sandbox (like a venv) it can't access themes installed in the "system Qt" that exists outside of it

#

(or maybe that only happens when PySide6 Qt version != system Qt version? I'm not sure, I'd need to experiment)

tranquil pewter
#

I think I did use a venv project

#

what is the recommended thing I should do?

tranquil pewter
#

@idle edge how do I install PySide6 Qt so it's not in a sandbox?

idle edge
#

Your distro will have a system package for PySide6
But idk how that'll interact with a venv Python

#

Sorry, it's really late here otherwise I would've experimented a bit and told you for sure

tranquil pewter
#

k sorry

frigid prismBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.