Questions tagged [pyside2]

Questions about using PySide2, a Python Qt bindings project for Qt5.

PySide2 was released mid June 2018 as a Technical Preview (supporting Qt 5.11), and it was officially released without the Technical Preview tag, in December 2018 for Qt 5.12.

The project started in May 2015.

Wikipedia:

PySide2 is a Python binding of the cross-platform GUI toolkit Qt, currently developed by The Qt Company under the Qt for Python project. It is one of the alternatives to the standard library package Tkinter. Like Qt, PySide2 is free software. The project started out using Boost.Python from the Boost C++ Libraries for the bindings and later switched to the binding generator Shiboken to reduce the size of the binaries and the memory footprint.

PySide was released under the LGPL in August 2009 by Nokia, the former owners of the Qt toolkit, after Nokia failed to reach an agreement with PyQt developers Riverbank Computing to change its licensing terms to include LGPL as an alternative license.

Work is currently underway to officially launch PySide2 as a Qt product, after all the effort on porting PySide to work with Qt 5.

PySide2 supports Linux/X11, Mac OS X, Windows and Maemo. Support for Android is currently being added by the PySide community.

The PySide2 Homepage can be found here

1728 questions
3
votes
1 answer

Embeding PyQtGraph in Qt-Designer using PySide2

I can't get PyQtGraph to work using PySide2 and a .ui file where I promoted a QWidget to a PlotWidget in Qt-Designer. It works fine when I use PyQt5, but using PySide2, I get the following message : Qt WebEngine seems to be initialized from a…
L. Arnaud
  • 55
  • 6
3
votes
1 answer

Is it possible to show the right side of a string first in an overfilled QTableWidgetItem?

The user is prompted with a file dialog and chooses a full path which is then put inside a QTableWidgetItem cell within a parent QTableWidget. Currently, when there is an overflow of text in the item and what it can display, it will show the left…
Mets_CS11
  • 99
  • 1
  • 9
3
votes
1 answer

QtSvg ignores units

Is there a way to get QSvgWidget/QSvgRenderer to work with units like cm/mm/in/pc? Here's a sample SVG where all lines should have the same length (it renders correctly in Firefox and Chrome):
rmweiss
  • 716
  • 1
  • 6
  • 16
3
votes
1 answer

PySide2: How to make a decorated slot execute on its worker thread?

Using Python 3.7 and PySide2, I created a worker object on a dedicated QThread to execute a long-running function. This is illustrated in the code below. import threading from time import sleep from PySide2.QtCore import QObject, QThread, Signal,…
derren
  • 33
  • 3
3
votes
2 answers

PySide2 QThread Error: QThread: Destroyed while thread is still running

I am new to PySide2. I am just trying to launch a sample application and start a thread as the application starts and want to stop the thread as the application closes. When I am closing the application I am getting the following error: QThread:…
3
votes
1 answer

QWebEngineView not showing anything on Windows 10

I've created a Python app that works perfectly on Mac but I need to be able to run it on Windows. So far, I'm stuck with my QWebEngineView not displaying anything. I've created a small piece of code to test but so far, it only shows a blank window…
3
votes
1 answer

QListWidgetItem objects are unhashable, it is a bug or there's a reason?

I stumbled upon this (it is, obviously, an extract from a bigger application): import sys from PySide2.QtCore import * from PySide2.QtGui import * from PySide2.QtWidgets import * if __name__ == '__main__': app = QApplication(sys.argv) d =…
user6369958
  • 357
  • 3
  • 16
3
votes
1 answer

How to change font size (in percent) of QLabel widget using setStyleSheet?

I am looking for a simple way to make a larger text size for a title label in my PySide2 app. This is a learning project. I prefer to use a style sheet to change the label font. I also do not wish to use hard coded point sizes because that may not…
MountainX
  • 6,217
  • 8
  • 52
  • 83
3
votes
1 answer

PySide2 raises error, "QPaintDevice: Cannot destroy paint device that is being painted"

I'm trying to paint something on a QPixmap, but it throws an error during cleanup. from PySide2.QtGui import QPixmap, QPainter from PySide2.QtWidgets import QApplication app = QApplication() width = 200 height = 100 pixmap = QPixmap(width,…
Don Kirkby
  • 53,582
  • 27
  • 205
  • 286
3
votes
1 answer

How to set values in qml using PySide2?

From PySide2 i want to write values into qml. This values change dynamically. For PyQt5 example here: How to set values in qml using PyQt5? main.py: import sys from PySide2.QtCore import QObject, Signal, Property, QUrl, QTimer, QDateTime from…
ITmindCo
  • 73
  • 6
3
votes
2 answers

Type error when calling QScreen.grabWindow()

I'm trying to take a screenshot using PySide (and return a QPixmap). This is part of a larger script. Unfortunately, I'm running into a wall at the moment. Here's a simplified snippet that I'm trying to get to work: from PySide2 import QtGui,…
3
votes
1 answer

Access list element in QML from python using the QAbstractListModel

I am a beginner in Qt and I am creating an Application by: Using QML for View design, Using python mainly for the Controller and Model part. Therefore, QML need to interact with the python objects. My problem: I have created a…
BeCurious
  • 127
  • 1
  • 9
3
votes
1 answer

What is the alternative to QWebInspector in Qt WebEngine?

The example of the code snippet is here: from PySide2 import QtCore, QtGui, QtWidgets, QtWebChannel from PySide2.QtWebEngineWidgets import QWebEngineView, QWebEngineSettings class AppWindow(QtWidgets.QMainWindow): def __init__(self, *args,…
3
votes
1 answer

PyQt 5: How to maintain relative widget size when expanding a window

I'm working on a custom ui in Maya 2018 which uses PyQt5 (via PySide2 - there are some minimal differences, but it's essentially PyQt5). I've got a QHBoxLayout with two widgets in it and their sizing policies are both set to 'expanding'. I set the…
silent_sight
  • 492
  • 1
  • 8
  • 16
3
votes
1 answer

Why are my QThreads consistently crashing Maya?

I have a UI that I am wanting to use threading with inside of Maya. The reason for doing this is so I can run Maya.cmds without hanging/freezing the UI while updating the UI with progress bars, etc. I have read a few examples from StackOverflow but…