MeVisLab offers (almost) the complete Qt Framework API to the Python programmer. Note that this support was added with MeVisLab 2.1 and is in a useable but still experimental stage. Feel free to post bugs or requests for missing functionality in the MeVisLab forum.
MeVisLab offers the following Qt bindings located in the PythonQt package:
The individual bindings can be dynamically imported using
from PythonQt import QtCore, QtGui, ...
or alternatively importing individual classes:
from PythonQt.QtCore import QObject, ... from PythonQt.QtGui import QPushButton, QRadioButton, ...
For detailed documentation of the Qt libraries, see http://qt.nokia.com/doc/4.6/index.html.
There are two possibilities to use QtGui components:
An example of adding Qt widgets via the initCommand of an MDL control:
yourmodule.script:
Window {
Vertical { initCommand = initVertical }
}
yourmodule.py:
from PythonQt.QtGui import QRadioButton
def radioButtonToggled(state):
print state
def initVertical(control):
button = QRadioButton()
button.text = "Some radio button"
button.connect("toggled(bool)", radioButtonToggled)
control.layout().addWidget(button)
While trying to be compatible to other Python/Qt binding like PyQt4 and PySide, there are many subtle differences. One major difference is that in MeVisLab, Qt properties are first class citizens and shadow the getter methods, while in PyQt4 and PySide the getters shadow the properties. Basically it should not be much work to get PyQt4 or PySide example to work in MeVisLab, by replacing the imports with PythonQt imports and by changing getter calls to property reads, e.g., w.height() becomes w.height in MeVisLab.
1.5.8