1

I'm trying to diagnose missing Slot decorators as specified in the end of the section https://doc.qt.io/qtforpython-6/tutorials/basictutorial/signals_and_slots.html#the-slot-class. I was able to activate this functionality when set the variable and run program from terminal. But I couldn't achieve this when set the variable in run configuration and launched from PyCharm.

This is my program:

import random
import sys
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QApplication, QLabel, QPushButton, QVBoxLayout, QWidget
class MyWidget(QWidget):
 def __init__(self):
 super().__init__()
 self.hello = ["Hallo Welt", "Hei maailma", "Hola Mundo", "Привет мир"]
 self.button = QPushButton("Click me!")
 self.text = QLabel("Hello World", alignment=Qt.AlignmentFlag.AlignCenter)
 self.layout = QVBoxLayout(self)
 self.layout.addWidget(self.text)
 self.layout.addWidget(self.button)
 self.button.clicked.connect(self.magic)
 def magic(self):
 self.text.setText(random.choice(self.hello))
if __name__ == "__main__":
 app = QApplication([])
 widget = MyWidget()
 widget.resize(800, 600)
 widget.show()
 sys.exit(app.exec())

These are the environment variables of run configuration: enter image description here

What am I doing wrong?

bad_coder
13.3k20 gold badges60 silver badges95 bronze badges
asked Sep 3, 2025 at 12:51
4
  • I think those environment variables depend on OS but also the application that's going to consume the environment variable. Try writing it like in this answer putting the right hand side between quotes, so: "qt.pyside.libpyside.warning=true". Commented Sep 4, 2025 at 7:44
  • in code you could check os.getenv("QT_LOGGING_RULES") to see if this variable was created by PyCharm. Commented Sep 4, 2025 at 13:52
  • @bad_coder Doesn't help. Commented Sep 15, 2025 at 16:41
  • @furas Checked, it was created. Commented Sep 15, 2025 at 16:41

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.