PDA

View Full Version : Use python widget created with PyQt4 in Qt applications



alizadeh91
27th November 2012, 06:16
Hi all,
I want to use MatPlotLib into Qt applications. I know that i have to use PyQt4, and also i know how to use QtDesigner with python.
But i don't know how to use widget created with python in qt applications???

wysota
27th November 2012, 09:35
Do I understand right that you wish to put some python code into your C++ application?

alizadeh91
27th November 2012, 16:52
I create a widget (with a plot into it) by python. Then i want to use this widget in my Qt application and put this widget inside my mainWindow which created in qt(not python) by hardcoding.
If i need to put python code in qt for that then that's true wysota. do you have suggestions for me?

wysota
27th November 2012, 22:33
I guess you need to embed a python interpreter in your program, import PyQt and MathPlotLib into the environment, do something to make the environment see your QApplication object and possibly other needed objects (such as windows) and then run some python code needed to get you going with the charts.