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
4
votes
1 answer

Embed Qt inside native window (Windows)

I'd like to embed a Qt Application inside Windows (not the other way around, as many other questions have already been answered). To clarify I have a win32 application which I launch a qt python process; this qt python process must be embedded…
Michael Choi
  • 610
  • 5
  • 22
4
votes
1 answer

How to place widget correctly in QGraphicsScene

I'm trying to implement a widget (an improvised toolbox) that will be placed on the right side of the scene. It should looks like this: There's a problem to place it correctly there and keep at the same size and position while moving and scaling…
Artem
  • 563
  • 3
  • 17
4
votes
1 answer

QVariant alternative when migrating from PyQt5 to PySide2

I am having some trouble switching from PyQt5 to PySide2 because of the following piece of code: class EnumModel(QtCore.QAbstractListModel): def __init__(self, list_of_enums): """ Enumeration model :param list_of_enums:…
Santi Peñate-Vera
  • 1,053
  • 4
  • 33
  • 68
4
votes
1 answer

Registering a type in QML using PySide2

I am trying to create a new QML type by using Python, but I am having trouble with registering a QML type. However, I am getting an Error: TypeError: 'PySide2.QtQml.qmlRegisterType' called with wrong argument types: …
4
votes
1 answer

Declaring a QAbstractListModel as a property in Pyside2

I am using Pyside2 with QML, and try to keep a good organisation of my code. I want to expose a subclass MyModel of QAbstractListModel from Python to QML, to use in a ListView. The code works perfectly if I declare the MyModel instance directly…
Benjamin Audren
  • 374
  • 2
  • 16
4
votes
1 answer

expanding tabs to full window size?

I've been struggling with something related to tabs for a few days now. I'm trying to make it so that the tab bar I have in my application extends across the full width of the window size. I’m working with both MacOS and Ubuntu, and while the final…
bag531
  • 179
  • 1
  • 9
4
votes
2 answers

python multiprocessing - sending child process logging to GUI running in parent

I'm building an interface on top of some analysis code I've written that executes some SQL and processes the query results. There's logging surrounding a number of the events in this analysis code that I would like to expose to the user. Because the…
dan_g
  • 2,712
  • 5
  • 25
  • 44
4
votes
1 answer

'PySide2.QtCore.Signal' object has no attribute 'connect'

I am trying to create a custom signal for a QRunnable Object for my PySide2 application. All examples have led me create a signal the following way: class Foo1(QtCore.QObject): def __init__(): super().__init__() self.thread =…
4
votes
2 answers

Embed Pyqtgraph to PySide2

I'd like to implement a PyQtGraph PlotWidget into a PySide2 application. With PyQt5 everything works. With PySide2 I get the Error shown at the bottom. I already found out, that there's some work in progress, but also it seems that a few people…
Sebus
  • 55
  • 1
  • 7
4
votes
2 answers

Pyside2 how to get mouse position?

I want to get mouse position in my pyside2 application.(not desktop mouse position that QCursor gives) and I tried two way. Bellow is my code. import sys from PySide2 import QtGui, QtWidgets, QtCore class Palette(QtWidgets.QGraphicsScene): def…
4
votes
1 answer

I would like to add a scroll bar to a QVBoxLayout

How do I add a scroll bar to my QVBoxLayout in PySide2. self.mainWidget = QtWidgets.QWidget() self.window.setCentralWidget(self.mainWidget) self.vertical_layout_main = QtWidgets.QVBoxLayout(self.mainWidget) scroll =…
winteralfs
  • 459
  • 6
  • 25
4
votes
0 answers

PySide2 (5.11.x): Unable to call type(QtWidgets.QWidget).__new__ in Python 2.7

We have a metaclass based on type(QtWidgets.QWidget) -- which resolves to Shiboken.ObjectType -- that we've had in production dating back to PySide/Qt4 that's breaking in the versions of PySide2 that are on pypy (5.11.x). Earlier alpha versions of…
jbee
  • 206
  • 2
  • 8
4
votes
1 answer

QLabel with image in round shape

I want to display image with round shape in PyQt5/PySide2 application. Below is the code i tried. self.statusWidget = QLabel() img = QImage(":/image.jpg").scaled(49, 49, Qt.IgnoreAspectRatio,…
4
votes
2 answers

How do I make a shortcut using arrow key with PySide2?

I want to add a keyboard shortcut to a button with Qt5 + Python (Pyside2). Code for making a shortcut with a regular key: import sys import random from PySide2 import QtCore, QtWidgets, QtGui class MyWidget(QtWidgets.QWidget): def…
mebaka
  • 61
  • 1
  • 4
4
votes
2 answers

PySide2 and pyinstaller gui application won't run on certain windows computers

I have built a small gui application using PySide2 as my gui framework and PyInstaller to make a one file exe file. The application works perfectly on some PCs (both Windows 7 and 10), however, on a few other PCs it won't launch - showing me the…
Jakey
  • 160
  • 1
  • 2
  • 10