finplot icon indicating copy to clipboard operation
finplot copied to clipboard

PySide6 compatibility

Open BinanceMan opened this issue 1 year ago • 3 comments

Hi highfestiva,,

I hope this message finds you well. I wanted to bring to your attention an issue I encountered while using the latest version of finplot with PySide6. Here's a brief overview:

Example: https://github.com/highfestiva/finplot/blob/master/finplot/examples/complicated.py

Error:

Traceback (most recent call last): File "/home/dev/finplot/complicated.py", line 434, in ctrl_panel = create_ctrl_panel(ax.vb.win) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/dev/finplot/complicated.py", line 381, in create_ctrl_panel panel = QWidget(win) ^^^^^^^^^^^^ TypeError: 'PySide6.QtWidgets.QWidget.init' called with wrong argument types: PySide6.QtWidgets.QWidget.init(FinWindow) Supported signatures: PySide6.QtWidgets.QWidget.init(Optional[PySide6.QtWidgets.QWidget] = None, PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags))

Operating System: Manjaro Python: 3.11.6 finplot: 1.9.4

Thank you for your time and for maintaining this awesome project! Let me know if you need any further information.

Best regards,

BinanceMan avatar Feb 23 '24 10:02 BinanceMan

I have no idea how to fix this, since I don't use PySide myself. If you do, please post a pull request and I'll verify it.

highfestiva avatar Feb 23 '24 23:02 highfestiva

Hi highfestiva,

Thank you for your prompt response.

I've thoroughly investigated the issue, attempting to identify an easy fix, but it appears to be more complex than anticipated. The challenge lies in attempting to add a non-QWidget object, specifically a FinWindow (pg.GraphicsLayoutWidget), to a QWidget.

I experimented with other examples, such as 'embed' and 'dockable,' and encountered the same problem consistently. What perplexes me is that these examples work seamlessly in PyQt6 but encounter issues in PySide6. Both PyQt6 and PySide6 are quite similar, particularly in their requirements for adding to QWidget.

My suspicion is that PyQt6 might be more lenient when checking the required types. I would appreciate any insights or suggestions you might have on resolving this issue.

Thank you once again for your assistance.

Best regards,

BinanceMan avatar Feb 24 '24 15:02 BinanceMan

@BinanceMan hey! Did you finally solved this problem?

Sharker5854 avatar May 19 '24 09:05 Sharker5854