Isotropix Forums

PyQt and Clarisse

Clarisse Scripting related topics

PyQt and Clarisse

Unread postby christianl013 » Tue Sep 13, 2022 4:25 am

Hi, first time post here but I had a question in regards to qt and clarisse.

I read this doc on qt integration: https://clarissewiki.com/5.0/sdk/using_pyqt.html

I applied this to my qt gui and it launches in clarisse just fine but one thing about is that I can not interact with clarisse when the dialog is open. Is this the expected behavior? I thought that by using the helper wrapper this would not be the case.

Has anyone else had any experience with this? I am using pyside2 and python 3.7.

Thanks.

Best, Christian
christianl013
 
Posts: 2
Joined: Fri Jan 25, 2013 11:33 pm

Re: PyQt and Clarisse

Unread postby anemoff » Wed Sep 14, 2022 2:34 pm

Hi,

This is not normal. Maybe you created a modal widget?
What OS are you using?
Can you share a minimal script that shows this?

Here is a very simple script with an always-on-top widget, but you can still interact with the rest of Clarisse GUI.

py code

import sys
import PySide2
from PySide2 import QtCore
from PySide2 import QtWidgets
import pyqt_clarisse

app = None
if not QtWidgets.QApplication.instance():
app = QtWidgets.QApplication(sys.argv)
else:
app = QtWidgets.QApplication.instance()

label = QtWidgets.QLabel("Hello World")
label.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
label.resize(200, 50)
label.show()

pyqt_clarisse.exec_(app)

Cheers,
Anthony Nemoff
Isotropix
R&D Engineer
User avatar
anemoff
 
Posts: 486
Joined: Wed Jan 13, 2016 10:10 am

Re: PyQt and Clarisse

Unread postby christianl013 » Wed Sep 14, 2022 6:59 pm

Thanks for the reply. I am currently on windows 10.

I have attached here a basic script of how I am doing this. I am trying to class the ui so I can have things a bit more organized. All of the examples I have seen go right into the heart of the matter in the script but I have alot of other functions I need to bring into the script.

I could not seem to get this working with right click context either or multithreading, the app would just freeze, so yeah, it seems I got something wrong here. I appreciate you taking a look at it.

Thanks again.
Attachments
minimal_script.py
(1.25 KiB) Downloaded 133 times
christianl013
 
Posts: 2
Joined: Fri Jan 25, 2013 11:33 pm

Re: PyQt and Clarisse

Unread postby anemoff » Mon Sep 19, 2022 4:29 pm

I've installed the packages qtpy and PySide2, and set the environment variable "QT_API=pyside2" but I can't run your script. I'm on Windows 10 too.
I also changed the imports to "from qtpy import ...". But I don't have QtCompat.loadUI and UI file is missing, so it can't run as is.

I'm not familiar with qtpy but I modified my previous example using qtpy and it runs:

py code

import sys

from qtpy import QtCore
from qtpy import QtWidgets
import pyqt_clarisse

app = None
if not QtWidgets.QApplication.instance():
app = QtWidgets.QApplication(sys.argv)
else:
app = QtWidgets.QApplication.instance()

label = QtWidgets.QLabel("Hello World")
label.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
label.resize(200, 50)
label.show()

pyqt_clarisse.exec_(app)


Can you show a simpler example that shows your problems?
What kind of functions do you need to bring into the script?
Anthony Nemoff
Isotropix
R&D Engineer
User avatar
anemoff
 
Posts: 486
Joined: Wed Jan 13, 2016 10:10 am


Return to Scripting
cron