Suggestions for learning wxPython

Suggestions
on learning wxPython from a newbie.

Hi. Although
I no longer work as a programmer (I
am now a manager, or as Dr. Dobbs Journal’s editors would say, a
“Mandarin.”) I
enjoy programming as a hobby and develop applications for a volunteer
organization. ‘C’ was my favorite language as
it allowed me
to express my ideas clearly with little syntactic overhead. C++ was too cumbersome for my taste and Java
was too bloated – the “brief” guide, O’Reilly’s “Java in a Nutshell”
is a
whopping 1252 pages – the antithesis of “running light without
overbyte.”

One day at
work, while walking among the cubicles and chatting to the programmers
on the
team developing a large database marketing application (using Java 2
Enterprise
Edition and Oracle) a programmer told me about his new favorite
language,
Python. I went online, downloaded
Python, and bought my favorite introductory Python book,
“Learning Python” by Lutz and Ascher. Programming
was fun again. Now I needed to find a GUI kit;
wxPython met
my needs. The online community is great
(especially the tireless efforts of Robin Dunn); well thought out
responses
often arrive in less than 24 hours.

Since I
often see others new to wxPython struggling, here are some suggestions:

  1. Know Python first before
    tackling wxPython.

Without
first understanding topics such as functions,
modules, and classes, adding wxPython to the mix will only increase the
confusion.

  1. Choose a good programming
    editor or IDE.

I use PythonWin from www.ActiveState.Com and have
also read
good things about SPE (Stani’s Python Editor).
I find the “default” Python IDE, IDLE lacking advanced
features. Features such as auto-completion,
code highlighting,
and an interactive window, make for faster programming with less errors.

  1. Play with each
    demonstration in the wxPython Demo.

Every
few weeks or so I go through the demo again as I may
have forgotten about a control that once seemed obscure but now is the
exact
thing I need for my application.

  1. Tinker with the code.

Once I
find a control I am interested in using, I copy the
demo code to my editor and delete all the unnecessary code until I find
the
statements that “do the work.” Then I
experiment with changing the arguments passed to the control’s
constructor
until I understand how it works. Only
then do I add the control to a larger application I am developing.

  1. Study other people’s code.

Charles
Simonyi, the legendary Microsoft programmer, grew up
in Hungary and had few books
available to him
from which to learn computer science. He
was able to get the source code for a compiler and studied the
printouts as
musicians would study musical scores.

There
are quite a few gems in the sample code that is
distributed with wxPython but is not in the Demo program, e.g.,
FrogEdit and
its underlying wx.lib.editor module. I
had assumed that an editor would be a wx.TextCtrl on steriods. I was surprised to see that the text was
“drawn” to the screen using a DC (device control) and learned some good
techniques. The code is more complex than to what I am accustomed, so
much rereading will be necessary.
I am also “reading” Transana and Task Coach,
two sophisticated applications written in Python and wxPython, to learn
how
large applications are structured.

  1. Use the references

I keep
the wxWidgets documentation open in one window and
the wxPython Demo in another as I use PythonWin to develop my programs. I often refer to these resources often and
sometimes cut and copy code into my application.

  1. Read the wxPython
    maillist messages that do not seem applicable to you.

I often
find techniques that I may need for the future and
save them to a special folder. After I
developed some ability in wxPython, I try to solve some of the
questions posed
to the community before I read the answer posted by a more experienced
programmer. Eventually I will be skilled
enough to assist others.

Ira

[...]

   7. Read the wxPython maillist messages that do not seem applicable to
      you.

    I often find techniques that I may need for the future and save them
    to a special folder. After I developed some ability in wxPython, I
    try to solve some of the questions posed to the community before I
    read the answer posted by a more experienced programmer. Eventually
    I will be skilled enough to assist others.

Hi Ira,

One short opinion... You *are* skilled enough to assist others! This is how I learned a lot of what I know about wxPython, trying to solve other people's problems :wink:
You don't have to be a guru to help, ok... so sometimes maybe my solutions were not elegant enough BUT I always learned from trying to help others, they were my teachers, the ones that silently said "why don't you know that, go look it up!"

Now I'll add one more suggestion:

8. Make wealth! Making money is trickier, making wealth is easy. Whatever small contribution you make to this community will come back to you tenfold. You don't have to be a guru, look at Andrea! the wxPython community is so much wealthier since he came.

Peter.

···

On Sun, 01 Jan 2006 04:27:33 +0200, Ira Kaplan <irakaplan@optonline.net> wrote: