473,508 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

About Embedding PyWin or wxPython


Folks: I want to embark on a project to add Python (actually, wxPython
or PythonWin) to a new Windows app I want to start writing soon.
Essentially, I want to take VB6 (or pos Delphi) and construct the app
framework/core functionality using one of those languages, then extend
the app w/ Python, the same way one can extend the MS Office apps
using VBA. The core Python docs provide the fundamental info one
needs to get started. But, I've been looking for some pointers to
articles/web pages that will bootstrap the effort, so I won't have to
completely reinvent the wheel. So far, the c.l.p ngroup traffic (and
the web in general) that speaks to this subject is apparently pretty
sparse. Since I'm a one-man show, it would be helpful if anyone could
offer pointers to sites/pages/books that address some of these issues:

1) To COM or not ? From an implementation standpoint, it seems
worthwhile to build the host app as a series of COM objects, which
could then be ref'd/manipulated via external Python code. Not sure if
this makes sense from a performance-perspective, but I doubt the apps
I'm thinking about (mostly desk accessory utils kinda, sorta) are
going to be compute-intensive at all.

2) SWIG or not ? Have never used it, but know that SWIG has been
ref'd many times in the ngroup as an tool for facilitating the use of
Python as an embedded language. Is SWIG worth the effort for a
relatively small (<10 KLOC) app ?

3) Handling exceptions. I want to start from Day One with a sensible
approach to debugging and testing both host objects and external
scripts.

4) Deployment. Size (30 - 50MB for wxPython or PyWin alone) and a
silent install of either pkg prior to installing the host app.

Regardless of the conversation in this group, I plan to get started in
the next few days. This is how I'm currently looking at the above
issues:

1) COM: Yes, since COM seems like an easy fit w/o writing lotsa
glue code because of built-in support via PyWin

2) SWIG: Not for a 1st cut, at least not to get one's feet wet, so
to speak

3) Exceptions: No clue. Need to closely read Extending/Embedding
Python for more guidance

4) Deployment: Bite the disk space bullet and use PyWin or wxPython as
is

Anyway, that's the beginning of the conversation. If you have any
observations or suggestions, please feel free. Later...MR

Jul 25 '06 #1
7 2304
Mr. Roboto wrote:
Folks: I want to embark on a project to add Python (actually, wxPython
or PythonWin) to a new Windows app I want to start writing soon.
Essentially, I want to take VB6 (or pos Delphi) and construct the app
framework/core functionality using one of those languages, then extend
the app w/ Python, the same way one can extend the MS Office apps
using VBA. The core Python docs provide the fundamental info one
needs to get started. But, I've been looking for some pointers to
articles/web pages that will bootstrap the effort, so I won't have to
completely reinvent the wheel. So far, the c.l.p ngroup traffic (and
the web in general) that speaks to this subject is apparently pretty
sparse. Since I'm a one-man show, it would be helpful if anyone could
offer pointers to sites/pages/books that address some of these issues:
You almost certainly would regard a copy of Hammind and Robinson's
"Python Programming on Win32" as remarkable value for money. It's an
axcellent book, and even has examples fo how you can make a VBA
application scriptable in Python.

If you are more interested in developing functionality that
experimenting, buying that book would save to a huge amount of time.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

Jul 25 '06 #2

Have you considered IronPython?

This is of course only an option if you're prepared to code in VB.NET
or C# instead of VB6 or Delphi, but it would provide seamless
integratioon between your Python code and the rest of your app and
would not require an external graphics library - although you would
need to distribute the .NET and IronPython runtimes.

Multiple-language and library integration is after all what .NET is all
about.
Simon Hibbs

Jul 25 '06 #3
Steve: Thanx for reminding me. I have that book around here
*someplace*. Never finished it, but will dig it out pronto. As you
so aptly point out, I want to develop more than experiment and who
better to learn from than the author of PyWin itself....

Steve Holden wrote:
You almost certainly would regard a copy of Hammind and Robinson's
"Python Programming on Win32" as remarkable value for money. It's an
axcellent book, and even has examples fo how you can make a VBA
application scriptable in Python.

If you are more interested in developing functionality that
experimenting, buying that book would save to a huge amount of time.

regards
Steve
Jul 25 '06 #4
Simon: Good idea, but I'm not yet .NET-compatible and can't handle
that learning curve in addition to everything else. IronPython is an
option I hadn't considered, but yours is a good idea for the next
project....

Simon Hibbs wrote:
Have you considered IronPython?

This is of course only an option if you're prepared to code in VB.NET
or C# instead of VB6 or Delphi, but it would provide seamless
integratioon between your Python code and the rest of your app and
would not require an external graphics library - although you would
need to distribute the .NET and IronPython runtimes.
Jul 25 '06 #5
Mr. Roboto wrote:
>
Folks: I want to embark on a project to add Python (actually, wxPython
or PythonWin) to a new Windows app I want to start writing soon.
Essentially, I want to take VB6 (or pos Delphi) and construct the app
framework/core functionality using one of those languages, then extend
the app w/ Python, the same way one can extend the MS Office apps
using VBA. The core Python docs provide the fundamental info one
needs to get started. But, I've been looking for some pointers to
articles/web pages that will bootstrap the effort, so I won't have to
completely reinvent the wheel. So far, the c.l.p ngroup traffic (and
the web in general) that speaks to this subject is apparently pretty
sparse. Since I'm a one-man show, it would be helpful if anyone could
offer pointers to sites/pages/books that address some of these issues:

1) To COM or not ? From an implementation standpoint, it seems
worthwhile to build the host app as a series of COM objects, which
could then be ref'd/manipulated via external Python code. Not sure if
this makes sense from a performance-perspective, but I doubt the apps
I'm thinking about (mostly desk accessory utils kinda, sorta) are
going to be compute-intensive at all.

2) SWIG or not ? Have never used it, but know that SWIG has been
ref'd many times in the ngroup as an tool for facilitating the use of
Python as an embedded language. Is SWIG worth the effort for a
relatively small (<10 KLOC) app ?

3) Handling exceptions. I want to start from Day One with a sensible
approach to debugging and testing both host objects and external
scripts.

4) Deployment. Size (30 - 50MB for wxPython or PyWin alone) and a
silent install of either pkg prior to installing the host app.

Regardless of the conversation in this group, I plan to get started in
the next few days. This is how I'm currently looking at the above
issues:

1) COM: Yes, since COM seems like an easy fit w/o writing lotsa
glue code because of built-in support via PyWin

2) SWIG: Not for a 1st cut, at least not to get one's feet wet, so
to speak

3) Exceptions: No clue. Need to closely read Extending/Embedding
Python for more guidance

4) Deployment: Bite the disk space bullet and use PyWin or wxPython as
is

Anyway, that's the beginning of the conversation. If you have any
observations or suggestions, please feel free. Later...MR

Do you have major performances issues ? why not write everything in
Python/WxPython ?
I used to write my applications in VB6 with python com objects ... and
decided there was no gain there.

Regards,

Philippe


Jul 25 '06 #6
Phillipe: Actually, it's not performance of the core app that concerns
me. I'm thinking more about UI/form *design* productivity. I've done
a lot of Access work over the years and while the stand-alone VB form
designer isn't quite as thorough, it's still one of the slickest out
there. Unfortunately, there's no designer for PyWin and wxPython's
XRC is nice but not in the same league as what can be done w/ Delphi
or VB. Yes, I'm aware that wxWidgets has a real form designer, but
that's yet another story, for another day.

Making XRC into a more fully-featured tool (more on par w/ the
aforementioned) is a way nice project unto itself, but not right now.
However, the desk accessory I've mentioned is an excellent 1st step
towards *possibly* doing something much bigger....

Philippe Martin wrote:
Do you have major performances issues ? why not write everything in
Python/WxPython ?
I used to write my applications in VB6 with python com objects ... and
decided there was no gain there.

Regards,

Philippe
Jul 25 '06 #7
Mr. Roboto wrote:
Phillipe: Actually, it's not performance of the core app that concerns
me. I'm thinking more about UI/form *design* productivity. I've done
a lot of Access work over the years and while the stand-alone VB form
designer isn't quite as thorough, it's still one of the slickest out
there. Unfortunately, there's no designer for PyWin and wxPython's
XRC is nice but not in the same league as what can be done w/ Delphi
or VB. Yes, I'm aware that wxWidgets has a real form designer, but
that's yet another story, for another day.

Making XRC into a more fully-featured tool (more on par w/ the
aforementioned) is a way nice project unto itself, but not right now.
However, the desk accessory I've mentioned is an excellent 1st step
towards *possibly* doing something much bigger....

Philippe Martin wrote:
>Do you have major performances issues ? why not write everything in
Python/WxPython ?
I used to write my applications in VB6 with python com objects ... and
decided there was no gain there.

Regards,

Philippe
I personally _really_ like wxDesigner (http://www.roebling.de/) and as
under VB6, I always avoided having the tables filled for me (bound forms if
I recall) I have not found my productivity go down ... but then again, I
never was a VB expert.

1)
As others have said, it is very easy to make a Python com object (thank you
Mark!) - and as long as Windows keeps supporting COM ....

2)
I chose the COM option

3)
If your script does not handle exceptions, you'll have a fairly cryptic VB
dialog box telling you about your python com object unhapiness - I find it
more easy to handle the expections in the script

4)
Yes it takes space - I have an application that uses Python, wxPython,
Gadfly, pyserial, HTMLGen ..... and the whole thing takes 120M

I used visual studio to buld a single install for everything- works well.
The one open issue I have about wxPython in a com object is how the main
event loop (in your core application) will react if a com object with GUI
pops-up ... never tried it.

Regards,

Philippe


Jul 25 '06 #8

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

Similar topics

1
1668
by: Tinmean K.H.Liu | last post by:
Hi! I install wxPython under WinXP when I want to use some simple sample, there is an error message: File "C:\Python22\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",line 301, in...
5
3504
by: Max Powers | last post by:
I've spent an interesting day searching the web for help with calling OCaml functions from a python program and have come to the newsgroup for some advice (unfortunately I'm learning both languages...
0
1561
by: The Jetman | last post by:
I'm trying to port PyWin into a limited version of Windows XP, called BartPE. Essentially, it's a matter of taking the installed elements of most WinApps (ie. registry settings and files) and...
2
3167
by: dr_tyson | last post by:
I am trying to embed images into a wxPython app (created using Boa Constructor), but have not been able to do so. I know how to embed plots, but images seem to be a problem. I've tried using code...
6
1821
by: Charles Krug | last post by:
Here's the deal: I've a dead-simple command-line program I'm using to test things that I can't (for various reasons) test in the IDE. Here's a do-nothing subset that shows the idea: #...
2
3791
by: Janto Dreijer | last post by:
I'm writing a Linux filemanager using wxPython. I'd like to embed a bash console inside it. I have found the Logilab pyqonsole (http://www.logilab.org/projects/pyqonsole), but it uses PyQT. Does...
1
1736
by: Mr. Roboto | last post by:
I need PyWin under the covers, that is, to install it as part of an application, but in such a way that it isn't visible to users. I'm concerned about a so-called "power-user", seeing the Python...
3
3825
by: gopython | last post by:
Hi all, Python:2.5 OS: Windows XP I have posted couple questions regarding the wxPython. Since I am still a newbie to Python, wxPython makes more sense to me than pyWin for gui programming....
0
3379
by: Soren | last post by:
Hi, I've been trying to embed matplotlib in wxpython. I want to be able to put a figure (axes) in a wx.Panel and place it somewhere in my GUI. The GUI should have other panels with buttons etc....
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3195
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.