PDA

View Full Version : QT4 in Visual Basic 2010 writing in Python



karlifornia
21st February 2012, 17:54
Hi Everyone,

I'm an absolute beginner when it comes to python and QT4. I programmed in VB10 for a semester and am trying to use VB10 to design a few GUI's.

I'm doing research in molecular modeling and the programs are written in python. The programs don't have GUI's associated with them and it is currently my task to create and link them to the modeling simulation programs.

I am familiar with Visual Studio 2010 and have added the .NET 4 Framework of QT4 into VB. I can create my GUI and reasonably map the buttons. However, in order to have the controls do anything other than the predetermined commands I need to be able to code the buttons individually.

I have absolutely no idea how to get the code to show up in VB. And I need it to show up in python.

Help and suggestions would be absolutely wonderful. I can provide screen shots or anything else. However, I am not a programmer so please bear with me as I struggle through this.

Thank you

qlands
24th February 2012, 12:31
Hi,

Let me see if I get it right... I do modelling on agricultural research :) :

Most of your models are in python, they don't have a GUI and its your task to link them and create some GUI for them.

Since this forum is for QT I will write thinking you intent to use QT and not VB :).

Assumptions:
1. The python scripts need certain inputs and produces certain outputs in stdin
2. You don't want to embed Python code in Qt just run an Python script from Qt.

How I would do it:

1. Create the GUIs using QT Creator - This IDE is IMHO the best to create Qt applications and is easier than VB. Get it from Nokia.
2. The GUI basically will have the input parameters, will run the python scripts and process its output.
3. Use a QProcess inside a QThread to run phyton script. It is useful to separate the python script inside another thread so the GUI can get any output without hanging.
4. Use QTextStream to read from the stdin. This will read the output generated by the python script.
5. Wait until the python finish.
6. Process the QTextStream and write the result of the model in the GUI.

I can give you a hand (stating bits) if you provide me with a very basic python script to test..

Good luck.
Carlos