Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

Added main language tag.
Source Link
bad_coder
  • 13.3k
  • 20
  • 60
  • 95

Pyside environment variable doesn't apply when specified in pycharmPycharm's run configuration

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 pycharmPyCharm.

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())
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())

Pyside environment variable doesn't apply when specified in pycharm run configuration

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.

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())

Pyside environment variable doesn't apply in Pycharm's run configuration

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.

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())
Source Link
Intolighter
  • 422
  • 3
  • 13

Pyside environment variable doesn't apply when specified in pycharm run configuration

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?

lang-py

AltStyle によって変換されたページ (->オリジナル) /