[wxPython] application design: Python and wxPython

I am an amateur (but serious) developer/programmer working mostly
alone. I've learned a lot from following this mailing list, but the
closer I get to working on a real application, the more I am
confronted with general questions of design/development philosophy.

Originally I had planned to write the core of my application in
pure Python with little or no dependency on the GUI toolset. During
a brief moment of insanity, in fact, I had even thought I might try
to create two or more user interfaces using different toolsets. I'm
safely beyond that now.

Anyway, my first thought was to use a variant of MVC architecture,
where the Model components would be pure Python and the
View/Control objects would be wxPython objects that know how to
set/get contents of the Model objects. Then I read Allan Hollub's
scathing criticism of MVC (especially set/get methods) and his
prescription for a version of the PAC architecture called
"Visual-Proxy." This would mean that each pure Python Abstraction
object would create a wxPython visual proxy for the Presentation
layer, all of which would be Controlled by a wxPython application
framework.

So I started looking at the whole wxPython-wxWindows application
framework, and the distinction between Python and wxPython began to
blur. Is it truly feasible, for example, to keep one's Python code
separate from the wxPython GUI code? And on a related note, when
(and why) should one use wxTime and wxDate as opposed to the Python
built-in time module? What about the wxString class vs Python
strings and so on? Also, one of the documented roles of the
wxValidator class is "to transfer data from a C++ variable or own
storage to and from a control." Can a wxPyValidator perform the
same role for Python objects?

Finally should I simply be thinking of wxPython as my application
development framework without regard to "pure Python" abstraction
components? I know these are rather vague questions, but any
insight from those of you who do this kind of thing every day would
be much appreciated. Thanks.

···

=====
Donnal Walter
Arkansas Children's Hospital

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

So I started looking at the whole wxPython-wxWindows application
framework, and the distinction between Python and wxPython began to
blur. Is it truly feasible, for example, to keep one's Python code
separate from the wxPython GUI code?

With discipline, yes.

And on a related note, when
(and why) should one use wxTime and wxDate as opposed to the Python
built-in time module?

wxTime and wxDate are not in wxPython at all (just in the C++ library where
they are deprecated)so that answers your question.

What about the wxString class vs Python
strings and so on?

wxString isn't there either. Python strings are automatically converted
to/from wxStrings as needed.

Also, one of the documented roles of the
wxValidator class is "to transfer data from a C++ variable or own
storage to and from a control." Can a wxPyValidator perform the
same role for Python objects?

It can, but it's not as automatic as in C++ since Python strings, numbers,
etc. are immutable. So for example if you pass a reference to a string to
the validator and the validator changes the value then a new object is
created. The original reference still points to the original string. What
I usually do is create validators that can take a reference to an object and
the name of an attribute, then it can use setattr and getattr to mainipulate
the value.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!