PySide | ATTENTION : This project is deprecated , please refer
kandi X-RAY | PySide Summary
kandi X-RAY | PySide Summary
ATTENTION: This project is deprecated, please refer to PySide2
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Imports a class or module .
- Process HTML tag .
- Generate inheritance diagram .
- Generate HTML for inheritance diagram .
- Main entry point .
- Render the inheritance diagram .
- Setup extension .
- End of the event .
- Exit qApp .
- Get the md5 hash of a node .
PySide Key Features
PySide Examples and Code Snippets
Community Discussions
Trending Discussions on PySide
QUESTION
I inherited an application with opencv, shiboken and pyside and my first task was to update to qt6, pyside6 and opencv 4.5.5. This has gone well so far, I can import the module and make class instances etc. However I have a crash when passing numpy arrays:
I am passing images in the form of numpy arrays through python to opencv and I am using pyopencv_to
to convert from the array to cv::Mat
. This worked in a previous version of opencv (4.5.3), but with 4.5.5 it seems to be broken.
When I try to pass an array through pyopencv_to
, I get the exception opencv_ARRAY_API was nullptr
. My predecessor solved this by directly calling PyInit_cv2()
, which was apparently previously included via a header. But I cannot find any header in the git under the tag 4.5.3 that defines this function. Is this a file that is generated? I can see there is a pycompat.hpp
, but that does not include the function either.
Is there a canonical way to initialize everything so that numpy arrays can be passed properly? Or a tutorial anyone can point me to? My searches have so far not produced any useful hints.
Thanks a lot in advance! :)
...ANSWER
Answered 2022-Apr-05 at 12:36I finally found a solution. I dont know if this is the correct way of doing it, but it works.
I made a header file that contains
QUESTION
I am trying to build an app from a python file (Mac OS) using the py2app extension. I have a folder with the python file and the "setup.py" file.
- I first tested the app by running
python setup.py py2app -A
in the terminal and the dist and build folder are successfully created and the app works when launched. - Now when I try to build it non-locally by running the command
python setup.py py2app
in the terminal, there are various "WARNING: ImportERROR" messages while building and finally aerror: [Errno 2] No such file or directory: '/opt/anaconda3/lib/python3.8/site-packages/rtree/lib'
error.
How can I fix this? I've tried to delete anaconda fully as I don't use it but it seems to still want to run through it. Additionally, I have tried to run the build command using a virtual environment but I end up having even more import errors.
*I Left out a lot of the "skipping" and "warning" lines using "..." for space
ANSWER
Answered 2022-Mar-13 at 16:13The error error: [Errno 2] No such file or directory: '/opt/anaconda3/lib/python3.8/site-packages/rtree/lib'
was caused by py2app trying to build the program bundle using a non-existent interpreter. This means that even if you try to uninstall a manager like Anaconda, it still has option logs somewhere on your mac.
The fix:
- Open the terminal and type the command
type -a python
.
- You will see similar lines
QUESTION
I'm attempting to implement a subclass of QQuickAsyncImageProvider
in Pyside6, referring to the official example. I'm already aware of the potential hurdle that, unlike in the C++ example code, with PySide it's not possible to inherit from both QRunnable
and QObject
. In order to send a signal from my QRunnable
I'm instead using an intermediary QObject
, as suggested here. That part works fine.
Here's my attempt so far at using this arrangement along with my own subclass of QQuickAsyncImageProvider
:
ANSWER
Answered 2022-Feb-22 at 13:19I reported this in case it was a bug, and one of the maintainers realized that the issue is that the AsyncImageResponse
gets immediately deleted. The workaround for this is to hold a reference to it in the AsyncImageProvider
:
QUESTION
I have a standard QProgressDialog with a cancel button. If/When the user clicks the cancel button, I don't want the dialog to immediately hide, instead I would prefer to disable the cancel button and perform some clean-up work, and then close the QProgressDialog once I'm sure this work is complete. How to I intercept the current function?
From the docs it seems like I should be overwriting:
PySide.QtGui.QProgressDialog.cancel()
Resets the progress dialog. PySide.QtGui.QProgressDialog.wasCanceled() becomes true until the progress dialog is reset. The progress dialog becomes hidden.
I've tried subclassing this method but it doesn't even seem to be called when I click the cancel button.
...ANSWER
Answered 2022-Feb-23 at 02:31To disable the button of the dialog you have to get a reference to it. Since it is a basic QPushButton, you can use findChild()
:
QUESTION
Setup description
- Table in PySide created with
QMainWindow - > QWidget -> QTableView -> TableModel (QAbstractTableModel) -> array[] - For second and third column is created ButtonDelegate(QStyledItemDelegate)
- buttons toggle value in the first column - but butons must be separate for specific reason in my application (toggling with one button is not a solution)
- button with value of the first column is "hidden"
- only whole single row is selected (important in my application where I'm separately showing detailed data on the selected row)
Detailed description of functionality
- Buttons in my application don't necesserily toggle value. Easiest to explaining fonctionality of my application is something like configuration list.
- Initially in the list are generic items which can be selected and the two buttons are "+" (add/select) and "-" (remove/deselect).
- Some items can be added only once, in that case the buttons are really only toggling the item selection. If not selected only the button "+" is show and if selected only button "-" is shown.
- Some items can be added multiple times. In that case initially the item is unseleted. Presing "+" selects the item, shows "-" buton, but button "+" is still shown, as the item can be added multiple times. When pressed "+" once again, the next row with the same item is added, again with both "+" and "-" shown. Then pressing "-" works in reverse way, removing row where "-" is pressed until last item of the same type, where "-" results in unselected item. Therefore function of +/- is content dependent.
- There few reasons I decided to have buttons in separate columns - keep possibility to sort based on selection state, header to show "Add" for "+" and "Remove" for "-"
Problem description
- when button in last column is disabled (pushing False button and then True button), the selection moves to next row - should remain in the same
- also, probably the showing and hiding of active button should be done in paint (instead of the openPersistentEditor). I was looking in the documentation and examples from google to find way how to, but still I haven't figured it out. If you could show me how, I would appreciate it. Also if you have link to some good tutorial on this topic (paint) I would be glad, because still I'm not getting how to use it.
Minimal functioning example:
...ANSWER
Answered 2022-Feb-04 at 05:30The reason for this behavior is that disabling the widget automatically sets the focus to the next available widget in the focus chain.
The actual behavior is based on the QAbstractItemView's re-implementation of focusNextPrevChild
, which creates a "virtual" QKeyPressEvent with a tab (or backtab) key that is sent to the keyPressEvent()
handler.
By default, this results in calling the table view's reimplementation of moveCursor()
, which focuses on the next selectable item (the first item in the next row in your case).
A possible workaround for this would be to use a subclass of QTableView and override focusNextPrevChild()
; in this way you can first check if the current widget is a button and a child of the viewport (meaning it's one of your editors), and eventually just return True without doing anything else:
QUESTION
Does anyone know if it's possible to have PySimpleGUI render HTML?
I am not after a full-blown browser, just an HTML viewer that lives in a PySimpleGUI window.
I know tkinter has a module called tk_html_widgets
, I'm also investigating what webview
module can do.
I know it is possible with Qt as PySide comes with a widget of this nature, though I'm really enjoying PySimpleGUI.
I was just wondering if anyone has a suggestion to achieve this.
For example, could I somehow import a TK widget such as tk_html_widgets
into PySimpleGUI.
Maybe I'm missing something and pysimpleGUI already has an HTML element that I am unaware of.
...ANSWER
Answered 2022-Jan-30 at 02:41It looks like you can do this with tkhtmlview widgets. I think the key is to get a handle to the tk root node using the TKroot attribute of the PySimpleGUI Window. You should be able to draw most tk widgets using that handle. Here's a simple example that draws an HTML label in a PySimpleGUI window:
QUESTION
I can't get the example from the PySide6 documentation working on my system. I am running PySide-6.2 on Ubuntu.
...ANSWER
Answered 2022-Jan-19 at 21:44It looks like a bug in PySide6. The returned object only has the inherited methods from QStringConverter, as can be seen by using dir
:
QUESTION
ANSWER
Answered 2021-Nov-15 at 21:45According to your code, all the items were centered so most likely they overlap. On the other hand, the root of Dice Item has no size so it will be difficult to manage them.
In this case it is better that the root is the Rectangle and that the Repeater is inside a Row (or Column or another similar component):
Dice.qml
QUESTION
I made a QML button component and I used a component named ColorImage
for the icon. After searching for a way to change image color. I found out that Qt no longer support ColorOverlay
Hover, I just typed in 'color' in Qt Design Studio and ColorImage
popped up. I tried to find documentation online but couldn't find anything. However, when I decided to try it, it just works as I expected:
This is the relevant code from my button:
...ANSWER
Answered 2021-Nov-14 at 16:05ColorImage is a Qt internal private component:
https://github.com/qt/qtdeclarative/blob/dev/src/quickcontrols2impl/qquickcolorimage.cpp
It doesn't appear to be supported for non-internal use.
If you really want to use it, try import QtQuick.Controls.impl 2.15
Note that ColorOverlay is available again in Qt 6.2 in Qt5Compat:
https://doc.qt.io/qt-6/qml-qt5compat-graphicaleffects-coloroverlay.html
It will eventually be replaced by Qt Quick MultiEffect:
QUESTION
I am playing around with Pipe
and Process
from the multiprocessing
module (Python 3.8). My initial program looks like this:
ANSWER
Answered 2021-Nov-12 at 12:15The issue you have is that you poll the pipe, but the documentation says:
poll([timeout])
Return whether there is any data available to be read.
If timeout is not specified then it will return immediately.
In the first example it works because when starting Process1
you send data to the pipe immediately:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install PySide
You can use PySide like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page