Python as alternative to Visual Basic

A

Aaron Ginn

I'm investigating the feasibility of using Python instead of Visual
Basic for a commercial software package that I'm planning on developing.
Now I'm absolutely a Python zealot. I use it for most of my software
development at work where I work in a Solaris environment. To me,
Python is the perfect language for most applications in a UNIX
environment where a compiled language is not required. However, I'm not
so sure about Windows.

The software package I'm developing will make calls to Excel and Access
and requires a very usable GUI for users who are not particularly
computer literate. My first question is: what is the best choice for a
GUI toolkit on Windows? I've used Tkinter for UNIX to some degree of
success, but I'm not sure this is the best choice for Windows. Second,
if I choose to make the application cross-platform (Windows and Mac OS X
in particular), what would be the best choice for a cross-platform GUI
toolkit? I was thinking of looking at PyQt. Is there a better option?

Basically, I'm trying to make a case for Python to the other developers
of this software package as I believe it offers numerous advantages over
VB in terms of speed of development, a quick learning curve, and
maintainability. Can anyone help me make that case?

Thanks,
Aaron
 
C

Chris Cioffi

Take a look at wxPython <http://www.wxpython.org/> for a start. It
seems to be the best of the FOSS GUI toolkits available for Python.
I've also heard very good things about pyQT, but I haven't had the
chance to play with it.

For the interacting with Excel and Access check out "Python
Programming on Win32". <http://www.oreilly.com/catalog/pythonwin32/>
It's a well written book and it will get you and and running in no
time.

I've done some, not a lot of, VB programming and I think that Python
is far simpler to use since it's so clean. It goes back to the "fight
the problem, not the language".

Hope this helps...

Chris
 
H

Harry George

Aaron Ginn said:
I'm investigating the feasibility of using Python instead of Visual
Basic for a commercial software package that I'm planning on
developing. Now I'm absolutely a Python zealot. I use it for most of
my software development at work where I work in a Solaris environment.
To me, Python is the perfect language for most applications in a UNIX
environment where a compiled language is not required. However, I'm
not so sure about Windows.

The software package I'm developing will make calls to Excel and
Access and requires a very usable GUI for users who are not
particularly computer literate. My first question is: what is the
best choice for a GUI toolkit on Windows? I've used Tkinter for UNIX
to some degree of success, but I'm not sure this is the best choice
for Windows. Second, if I choose to make the application
cross-platform (Windows and Mac OS X in particular), what would be the
best choice for a cross-platform GUI toolkit? I was thinking of
looking at PyQt. Is there a better option?

Basically, I'm trying to make a case for Python to the other
developers of this software package as I believe it offers numerous
advantages over VB in terms of speed of development, a quick learning
curve, and maintainability. Can anyone help me make that case?

Thanks,
Aaron

We do a lot of inhouse Win32 Python development. Most of the projects
use PyQt via BlackAdder, with some in wxPython. Python has been solid
for win32 com calls (that ordinarily would use VB). Sometimes we have
to write a sample in VB to get the API understood, and then code it
cleanly in Python (esp. true for macro capture mechanisms, where the
COTS app generates VB.)

Just in terms of time-to-market it should be a winner, even if at some
point you have to port to some other language (more likely C# or Java
than VB).

We find an experienced programmer needs about 2 weeks to ramp up on
python. Peer-level code reviews help in growing the team knowledge
level.
 
A

Alex Martelli

Aaron Ginn said:
The software package I'm developing will make calls to Excel and Access
and requires a very usable GUI for users who are not particularly
computer literate. My first question is: what is the best choice for a
GUI toolkit on Windows?

If you can afford the Qt+PyQt license (cheapest if you buy BlackAdder,
actually), as you seem to indicate by mentioning you're considering it,
that would be my choice. Many swear by wxWidgets+wxPython, though,
which has the advantage of not requiring you to pay for a license.
Basically, I'm trying to make a case for Python to the other developers
of this software package as I believe it offers numerous advantages over
VB in terms of speed of development, a quick learning curve, and
maintainability. Can anyone help me make that case?

Not unless you first clarify whether you mean classic VB (VB.6) or VB.7
(aka VB.NET), since they're pretty different despite some superficial
syntax similarities. Actually this may be part of the case you want to
make: if you choose a proprietary language you're getting, bound hands
and feet, in the clutches of that language's owner. If they decide to
make the transition between release 6 and 7 a revolution that wipes out
your existing know-how and breaks your existing code, tough luck.
Choose an open-source language that's careful about backwards
compatibility issues, such as Python, and you're hedging against that.

Second, the choice between a language which is designed never to run
anywhere else, and one that IS cross-platform. Sure, today you're
targeting Windows exclusively. Say that tomorrow the Thai government,
or a large bank, whatever, falls in love with your app, but they use
Linux exclusively. Can you grasp the hundred millions that hover so
tantalizingly close to your clutches...? If you chose VB, probably not.
If you chose Python, probably yes. Why curtail your future options?

Then we can get into issues of more interest to developers, but these
are great to use with any manager or investor type;-).


Alex
 
C

Carlos Ribeiro

The software package I'm developing will make calls to Excel and Access
and requires a very usable GUI for users who are not particularly
computer literate. My first question is: what is the best choice for a
GUI toolkit on Windows? I've used Tkinter for UNIX to some degree of
success, but I'm not sure this is the best choice for Windows. Second,
if I choose to make the application cross-platform (Windows and Mac OS X
in particular), what would be the best choice for a cross-platform GUI
toolkit? I was thinking of looking at PyQt. Is there a better option?

I'm in a similar position, and I've evaluated a lot of tools over the
past weeks. As far as connecting your app to Excel and Access, it's a
snap -- either using COM, or using any of the higher level libraries
available. In fact, using Python to use COM and OLE automation stuff
is so easy that one wonders at why did Microsoft not support it from
the beginning :)

The GUI is another matter. There are good libraries, such as Qt and
wxPython. Most people will point you to wxPython because its cross
platform, and also because of licensing issues. But, as far as IDEs
are concerned, the scenario is not that good. For simple applications,
PythonCard is a good starting point. Boa Constructor is a promising
tool, and is very close to commercial IDEs in a lot of respects. In my
particular case, I found it a little slow (my machine is showing its
age now), and lacking a few features that I wanted -- but it might
suit your needs better than mine. You can also take a look at
BlackAdder (for Qt), but that's commercial. Besides that, you have to
use a non-integrated GUI design tool such as wxGlade or wxDesigner.

There is a promising approach to GUI building in the form of simple,
more pythonic, APIs that are intended to hide the complexity of the
real GUI toolkits (wxPython, for example). From the top of my mind, I
can point you to AnyGUI, PyGUI, and WAX. The problem is that these
tools are either abandoned or not mature enough. They were discussed
here over the past few days, take a look at recent archived posts to
check it out.

AnyGUI -- http://anygui.sourceforge.net/
PyGUI -- http://www.cosc.canterbury.ac.nz/~greg/python_gui/
Wax -- http://zephyrfalcon.org/moin.cgi/Wax


--
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: (e-mail address removed)
mail: (e-mail address removed)
 
N

Nelson Minar

Good questions and nice research.

I was surprised at how many Windows-specific elements were available
in Python. Here are some notes from me writing a toy system tray app:
http://www.nelson.monkey.org/~nelson/weblog/tech/good/pythonWindows.html

One thing you should look into is IronPython, the new Python-on-.NET
implementation. It's still pretty early on in development, so may not
be appropriate for your commercial needs. But it's quite interesting.
The software package I'm developing will make calls to Excel and
Access and requires a very usable GUI for users who are not
particularly computer literate.

You can learn a lot from a day or two of prototyping. Try out a bit of
COM integration, build a user form using wxWindows or PyQt. See if you
like it.
 
N

Neuruss

I suggest PythonCard.
It's by far the easiest tool for creating cross-platform GUI apps
based on wxPython in a visual way (dragging and dropping widgets into
a form). The downside is that some widgets are not yet implemented,
but you can use the most important ones.

Another good thing is that it creates authomatically two files: one
for the presentation (form, buttons, etc) and another for the code,
which makes it very simple and clean.
 
G

Graeme Matthew

As an ex VB developer who jumped to Python, I can say that you do not need
to worry about its worability on windows. If youre using Access / excel etc
then Pythonon has a com library so even ADO connections are fine. To connect
to SQL etc simply use the Win32 ODBC package found in the Python Win32All
installation.

In terms of GUI's there is wxWindows which is cross platform and Tkinter
which is proven on both platforms. I have not investigated this one yet but
there is also Mono the open source .NET standard this in theory would should
allow you to call the .NET Framework and use its objects / libraries

I would say and this is my biggest concern is what is Microsoft up to in the
next few years and where is .NET going?
 
F

Fred

And don't forget ctypes! Although not a Windows-only tool, on a Windows system
it opens the door to pretty much every Win32 API there is, all from pure Python.

Is there a framework that uses ctypes and wraps the Windows API as a
set of classes? I'd rather use the native Windows widgets instead of
using wxWidgets or Qt, but I don't really like PythonWin/MFC.

Fred.
 
A

Aaron Ginn

I just want to thank everyone who has responded thus far. It seems like
Python will do what I require in terms of its COM interoperability.
That's very good news! WxPython sounds like my best alternative to
creating a cross-platform interface with what appears to be a nice
Windows look and feel. That's something I'll definately investigate.

Thanks,
Aaron
 
F

F. Petitjean

Is there a framework that uses ctypes and wraps the Windows API as a
set of classes? I'd rather use the native Windows widgets instead of
using wxWidgets or Qt, but I don't really like PythonWin/MFC.

Fred.
Yes : venster http://venster.sourceforge.net

and here is a way to be explicit in the Windows API :

def prototype(func, result_type, *argstypes):
"""prototype(func, result_type, *argstypes) -> None
Set the prototype of function func"""
func.restype = result_type
func.argtypes = argstypes


_user32 = windll.user32

DefWindowProc = _user32.DefWindowProcA
prototype(DefWindowProc, LRESULT, HWND, UINT, WPARAM, LPARAM)

and so on (in windows.py)

regards.
 
D

drs

Aaron Ginn said:
I just want to thank everyone who has responded thus far. It seems like
Python will do what I require in terms of its COM interoperability.
That's very good news! WxPython sounds like my best alternative to
creating a cross-platform interface with what appears to be a nice
Windows look and feel. That's something I'll definately investigate.

The responses here have glossed over that if the OP is using COM, there
really is no need for a cross platform GUI, and if the choice is between VB6
and Python, again there is no cross platform issue.* That said, I have
found that creating interfaces in VB6 and objects in Python is a great way
to get the best of both worlds.

-d

Perhaps the exception is using pyro to remotly control COM objects from a
*nix box.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,206
Messages
2,571,069
Members
47,678
Latest member
Aniruddha Das

Latest Threads

Top