ich versuche seit Tagen QT Creator ans Laufen zu bekommen, leider ohne Erfolg.
Was ich bisher gemacht habe:
- QT mit einem Onlineinstaller installiert QT6.2.2
- Python 3.10.1 von Python.org installiert
- mit "python3 -m venv /path/to/new/virtual/environment" Virtuelle Umgebung erstellt im eigenen Ordner
- mit "pip Install PySide6" PySide6 in den "Venv" Ordner installiert
Einfach nur ein Fenster mit einem PushButton und Einem Label.
Beim Klicken auf RUN wird nur ein leeres Fenster angezeigt und folgende Fehlermeldung wird angezeigt:
Code: Alles auswählen
qt.pysideplugin: Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out.
qt.pysideplugin: No instance of QPyDesignerCustomWidgetCollection was found.
Qt WebEngine seems to be initialized from a plugin. Please set Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute and QSGRendererInterface::OpenGLRhi using QQuickWindow::setGraphicsApi before constructing QGuiApplication.
Hier sind noch mal die Codes:
mainwindow.py:
Code: Alles auswählen
# This Python file uses the following encoding: utf-8
import os
from pathlib import Path
import sys
from PySide6.QtWidgets import QApplication, QMainWindow
from PySide6.QtCore import QFile
from PySide6.QtUiTools import QUiLoader
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
self.load_ui()
def load_ui(self):
loader = QUiLoader()
path = os.fspath(Path(__file__).resolve().parent / "form.ui")
ui_file = QFile(path)
ui_file.open(QFile.ReadOnly)
loader.load(ui_file, self)
ui_file.close()
if __name__ == "__main__":
app = QApplication([])
widget = MainWindow()
widget.show()
sys.exit(app.exec())
Code: Alles auswählen
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>460</width>
<height>309</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="lbl_hallo_welt">
<property name="font">
<font>
<pointsize>34</pointsize>
</font>
</property>
<property name="text">
<string>Hallo</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_klick_mich">
<property name="text">
<string>Klick Mich!</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>460</width>
<height>24</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>
Und QPyDesignerCustomWidgetCollection verwende ich auch nicht.
Ich hoffe ihr könnt mir weiter helfen.
Danke im Voraus