How to access qtcore constants in Python?

I can import qt in a slicelet and use all qtwidgets. But how can I qtcore.
And also is there a way to PyQt5 so that I can use the qtcore from there…

Slicer uses PythonQt library for Python wrapping of Qt. PyQt is not free to use (it has GPL/commercial license), so we have never even considered using it. Python for Qt is very popular, as it is provided by the Qt company, but PythonQt has many advantages - most importantly that it is intended for applications that embed Python.

Anyway, Slicer imports all Qt packages in qt namespace. For example, QFile class in qtcore can be accessed as qt.QFile()

But how can I get the core variables like qtCore.horizontal, vertical etc… to set the orientations, behaviour etc. of various widgets.

Constants in the global C++ Qt namespace are in Qt namespace in Python. For example qt.Qt.Horizontal.

That worked…
Thank You sir…

1 Like