473,320 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

VB6 frontend GUI with Python

I am trying to write a VB6 (not VB.Net) application that has a console
window that allows Python command to be typed at the prompt.

The idea is so that, I can have full Python scripting from within my
application. I should be able to type commands from a Python script
(include import etc, so I can use other Python libraries). In other
words, I want to provide a complete (or almost complete) interactive
Python Scripting environment from within my application - so that I
enter commands in the VB6 console, and I get the (text) results
displayed in my VB6 console, and in the case of a graphic output (let
say I am importing wxPython for graphing functionality), I would have
the graph display after I have typed my command in my VB6 console.

My initial route was to try to embed the Python interpreter, using BOOST
Python, writing a Win32 DLL around that and then calling the functions
from VB6. But I had various problems with that approach - so I am now
looking to use a Python COM server approach (although I would have
preferred not to touch COM).

I have done a lot of Googling and research online - but I can't find
anything remotely useful, taht shows me how to do what I want to do. If
anyone has done something similar to what I am trying to do, or knows of
any links that may show me how to do provide a VB6 frontend GUI (i.e.
console) fo ruse with Python, I will be very grateful.
Nov 20 '07 #1
4 3128
Claire Blair wrote:
I am trying to write a VB6 (not VB.Net) application that has a console
window that allows Python command to be typed at the prompt.

The idea is so that, I can have full Python scripting from within my
application. I should be able to type commands from a Python script
(include import etc, so I can use other Python libraries). In other
words, I want to provide a complete (or almost complete) interactive
Python Scripting environment from within my application - so that I
enter commands in the VB6 console, and I get the (text) results
displayed in my VB6 console, and in the case of a graphic output (let
say I am importing wxPython for graphing functionality), I would have
the graph display after I have typed my command in my VB6 console.

My initial route was to try to embed the Python interpreter, using BOOST
Python, writing a Win32 DLL around that and then calling the functions
from VB6. But I had various problems with that approach - so I am now
looking to use a Python COM server approach (although I would have
preferred not to touch COM).

I have done a lot of Googling and research online - but I can't find
anything remotely useful, taht shows me how to do what I want to do. If
anyone has done something similar to what I am trying to do, or knows of
any links that may show me how to do provide a VB6 frontend GUI (i.e.
console) fo ruse with Python, I will be very grateful.
You keep talking about "a console", but OTOH you want to use wxPython -
which clearly is not console, but GUI. So I'm not really sure what you are
after.

It might be possible to make wx render into a given window-handle.

But may I ask: what is the reason for using VB at all? Why not do the
GUI-frontend in wxPython?

Diez
Nov 20 '07 #2


Diez B. Roggisch wrote:
Claire Blair wrote:

>>I am trying to write a VB6 (not VB.Net) application that has a console
window that allows Python command to be typed at the prompt.

The idea is so that, I can have full Python scripting from within my
application. I should be able to type commands from a Python script
(include import etc, so I can use other Python libraries). In other
words, I want to provide a complete (or almost complete) interactive
Python Scripting environment from within my application - so that I
enter commands in the VB6 console, and I get the (text) results
displayed in my VB6 console, and in the case of a graphic output (let
say I am importing wxPython for graphing functionality), I would have
the graph display after I have typed my command in my VB6 console.

My initial route was to try to embed the Python interpreter, using BOOST
Python, writing a Win32 DLL around that and then calling the functions
from VB6. But I had various problems with that approach - so I am now
looking to use a Python COM server approach (although I would have
preferred not to touch COM).

I have done a lot of Googling and research online - but I can't find
anything remotely useful, taht shows me how to do what I want to do. If
anyone has done something similar to what I am trying to do, or knows of
any links that may show me how to do provide a VB6 frontend GUI (i.e.
console) fo ruse with Python, I will be very grateful.


You keep talking about "a console", but OTOH you want to use wxPython -
which clearly is not console, but GUI. So I'm not really sure what you are
after.
Yes, this seems to be confusing a lot of people. I want to be able to
use various existing plotting libraries (most of which use wxPython or
pyOpenGL). The end result is that (assuming my paths etc have been
correctly set), I can type something like this in my console:
>>import someGraphingModule
# a few other commands to fetch data etc ...

# The following line will then open a window (using
# wxPython, wxOpenGL (or whatever windowing library is
# is provided by module someGraphingModule
someGraphingModule.plotdata
>
It might be possible to make wx render into a given window-handle.

But may I ask: what is the reason for using VB at all? Why not do the
GUI-frontend in wxPython?

Diez
Simple. its because my main application (the GUI that is), is written in
VB6. I have a MDI application (i.e. many child windows in the same
application), and I want to use one of these windows as a console to
inteactively type Python commands. If I were to use wxPython, I would
not be able to treat the console 'the same' as the other child windows
in the application (i.e. minimize, close all etc). Maybe a simpler way
to think of this is to imagine that I am writing a PythonWin clone in
VB6. What I am asking here, is how can I create the 'Interactive Window' ?
Nov 20 '07 #3
Simple. its because my main application (the GUI that is), is written in
VB6. I have a MDI application (i.e. many child windows in the same
application), and I want to use one of these windows as a console to
inteactively type Python commands. If I were to use wxPython, I would
not be able to treat the console 'the same' as the other child windows
in the application (i.e. minimize, close all etc). Maybe a simpler way
to think of this is to imagine that I am writing a PythonWin clone in
VB6. What I am asking here, is how can I create the 'Interactive Window' ?
Your asking for more. Your asking for the interactive window (which
shouldn't be too hard, just using subprocess and somehow attaching
stdin/stdout - there should be code that does that) AND you are asking for
integration of GUI. Which is much more complicated. I'm not a windows guru,
but at least you need a way to communicate a window-handle to some
background thread or so of the python interpreter, which will be used to
render the plot. But that of course implies that the various plotting libs
are somehow capable of doing so.

I know that for example under X-windwow, you can "capture" one window and
display it as part of another. If there exists something like that in
Windwos, a way to shell various applications, that would help you.

Apart from that the only thing that comes to my mind is an ActiveX-control,
but even there I'm ont sure how event-loops and stuff behave.

All in all - an integration hell....

Diez
Nov 20 '07 #4
On Behalf Of Claire Blair
I am trying to write a VB6 (not VB.Net) application that has
a console window that allows Python command to be typed at the prompt.
I'm not sure what pieces of the puzzle you're missing. Were you able to
create a simple COM server with Python?

At a conceptual level, how about this:

* Your VB form creates an instance of the Python COM server
* You pass a reference to the form to the COM server (server.SetForm Me
'etc...)
* You have a textbox in your VB form. You listen for Return key events
* When you get a return key, you call a method on the COM server that says
"submit text line"
* The COM server examines the last line of text in the form's text box, and
takes any necessary action, including:
+ Eval a line of interactive Python code
+ Write a result to the VB form's text box

Do the above steps sound feasible?

Regards,
Ryan Ginstrom

Nov 20 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Al Bogner | last post by:
Since weeks I am searching the net from time to time how to build a small MYSQL-Frontend for a simple small database. The last decision ist not made, but it looks like, that I will learn Python. ...
3
by: w | last post by:
Hello all!!! For a year and a half now, we have been developing different Access 2000 applications. Most of them are access frontend and access backends. Some of them have SQL server 2000 as a...
16
by: Wayne Aprato | last post by:
I have several Access 97 databases which are split into front end and back end running off a server. The front end mde is shared by 2 or 3 - absolute maximum of 6 concurrent users. This scenario...
6
by: Steve Crawford | last post by:
I've started seeing the following in my logs: FATAL: invalid frontend message type 8 I searched back over a month and there are 5 instances of this error of which 4 are in the last 24 hours. ...
10
by: Stelios Xanthakis | last post by:
It had to happen :) http://pyvm32.infogami.com/EPL Seriously, this is not so much about the whitespace as for the new features, which might interest people who are thinking about new...
9
by: philelpko | last post by:
Good Morning all, Lost once again which is becoming a common occurance atm. My database has successfully been broken into a frontend and a backend db. A problem has now arisen as it has become...
3
by: nik | last post by:
I have a VB6 application that I would like to attach to a python communications application. I have come across several discussions on using VB with a Python COM back-end, but no starting point....
5
by: Anonymous | last post by:
I am trying something which appears (so far), that many other people have not yet tried before - since I can't find any useful related material despite several days of searching various sites/blogs...
1
by: bogie | last post by:
Dear Friend I have some question related to postgresql frontend. I have develop postgresql web based database under linux environment and I use Gedafe as frontend and Apache as server. and now i...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.