@muxing It's useful for a large range of applications whether on the command line or using a GUI.
It's used for automation, scientific computation, application extension, etc.
As I wrote above, you have to be careful when you code for it (as for any other language, all have limits).
As for the multi-threading part, check Python 3.13. The GIL is being removed.
@TheJester12121 said in Widget not able to create new widget ?:
otherwindow = QWidget()
This widget has no parent, it is not added to another widget directly or (better) on a layout belonging to parent widget. And no reference is kept to it in e.g. self. Hence Python will destroy it on exit from create_window(). Other languages (e.g. C++) would not. I don't know exactly where in https://www.pythonguis.com/tutorials/creating-multiple-windows/ you claim this precise code came from.
Ahh I figured. This was due to:
QGroupBox {
background-color: #3B4252;
border: 1px solid #4C566A;
border-radius: 5px;
margin-top:20px;
}
margin-top:20px; cause this issue
You are firing a signal that belongs to a widget class which shall only happen in the main thread. Use the worker object approach with a QObject based class no QWidget there.
(Try to avoid loadUi at all cost, and rely on generating a Python file out of it https://doc.qt.io/qtforpython-6/tutorials/basictutorial/uifiles.html#option-a-generating-a-python-class )
@JUDE34823 you can check out this answer: https://forum.qt.io/topic/157892/qt-design-studio-python-code/2
In a nutshell you just need a python file to load the Quick-based project you created with QtDS
and then if you want to add functionality to the graphical elements, you need to check the tutorials/examples on how to register a QmlElement python object in QML, so you can access that functionality. For example https://doc.qt.io/qtforpython-6/tutorials/qmlintegration/qmlintegration.html
Hey @tinkerer42 this is a feature that will be announced in the following days.
There are a couple of things that you need to keep in mind:
Qt Design Studio provides a few ad-hoc QtQuick components that are not found in Qt installations, but only within Qt DS. For that, we recently uploaded a package that you can get via pip install pyside6_ds that will copy those components into your PySide6 installation
Having the QtDS components is not enough, you need a specific structure on your main python file, which should look a bit like:
import os
import sys
from pathlib import Path
from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import QQmlApplicationEngine
if __name__ == '__main__':
app = QGuiApplication(sys.argv)
engine = QQmlApplicationEngine()
app_dir = Path(__file__).parent.parent
engine.addImportPath(os.fspath(app_dir))
# import_paths = ["...", "...", ...] # for all the paths you have files.
for path in import_paths:
engine.addImportPath(os.fspath(app_dir / path))
# url = "/path/to/your/main.qml"
engine.load(os.fspath(app_dir/url))
if not engine.rootObjects():
sys.exit(-1)
sys.exit(app.exec())
There will be a blog post in the following weeks with the new features that QtDS will have.
You can also rely on the PYSIDE_DESIGNER_PLUGINS variable to point where the plugin is?
https://doc.qt.io/qtforpython-6/tutorials/basictutorial/uifiles.html#designer-custom-widgets
This is a Windows 11 new style change, and I was able to reproduce with the C++ example, so it's not PySide-related.
On Linux I was unable to reproduce. The solution is to force the usage of a different style like the Windows Vista or Fusion.
Linux (PySide)
[image: 34b5904b-0945-491f-b6e8-1cc3d9899b61.png]
Windows 11 (C++)
[image: 6788192c-d01e-4ce4-ba7a-b65f30e33cfd.png]
And for reference, here you have a tutorial for using icons/images https://doc.qt.io/qtforpython-6/tutorials/basictutorial/qrcfiles.html as @SGaist mentioned, you are mixing two different bindings:
PyQt6 is developed by Riverbank Computing
PySide6 is developed by The Qt Company
Even though most of the API is similar, they cannot be mixed.
@SGaist said in QTableView formatting depends on app style:
Hi,
There's a new style for Windows11 that seems to have some issue. You can also try the windowsvista style.
Yes, you're right, thanks.
I kept looking for and found that: [https://bugreports.qt.io/browse/QTBUG-126543](link url) so it is definetely a bug.
Most likely, the Qt build used for PySide is not compatible with the build on the system. Please run with the environment variable QT_DEBUG_PLUGINS set and check the output.