-\chapter{wxPython Notes}\label{wxPython}
+\section{wxPython overview}\label{wxpython}
+%\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
+%\setfooter{\thepage}{}{}{}{}{\thepage}%
-\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
-\setfooter{\thepage}{}{}{}{}{\thepage}%
-
-This addendum is written by Robin Dunn, author of the wxPython wrapper
+This topic was written by Robin Dunn, author of the wxPython wrapper.
wxPython is a Python package that can be imported at runtime that
includes a collection of Python modules and an extension module
(native code). It provides a series of Python classes that mirror (or
wxPython is a Python package that can be imported at runtime that
includes a collection of Python modules and an extension module
(native code). It provides a series of Python classes that mirror (or
-shadow) many of the wxWindows GUI classes. This extension module
-attempts to mirror the class heirarchy of wxWindows as closely as
+shadow) many of the wxWidgets GUI classes. This extension module
+attempts to mirror the class hierarchy of wxWidgets as closely as
possible. This means that there is a wxFrame class in wxPython that
looks, smells, tastes and acts almost the same as the wxFrame class in
the C++ version.
possible. This means that there is a wxFrame class in wxPython that
looks, smells, tastes and acts almost the same as the wxFrame class in
the C++ version.
applications, or in situations where Python is embedded in a C++
application as an internal scripting or macro language.
applications, or in situations where Python is embedded in a C++
application as an internal scripting or macro language.
details about getting wxPython working for you.
%----------------------------------------------------------------------
details about getting wxPython working for you.
%----------------------------------------------------------------------
then I usually code it as an extension module and leave the majority
of the program in Python.
Another good thing to use wxPython for is quick prototyping of your
then I usually code it as an extension module and leave the majority
of the program in Python.
Another good thing to use wxPython for is quick prototyping of your
edit-compile-link-run cycle, which can be quite time consuming. With
Python it is only an edit-run cycle. You can easily build an
application in a few hours with Python that would normally take a few
edit-compile-link-run cycle, which can be quite time consuming. With
Python it is only an edit-run cycle. You can easily build an
application in a few hours with Python that would normally take a few
should be a straight forward task.
%----------------------------------------------------------------------
should be a straight forward task.
%----------------------------------------------------------------------
on nearly every platform that Python and Tcl/TK are. Why Tcl/Tk?
Well because Tkinter is just a wrapper around Tcl's GUI toolkit, Tk.
This has its upsides and its downsides...
on nearly every platform that Python and Tcl/TK are. Why Tcl/Tk?
Well because Tkinter is just a wrapper around Tcl's GUI toolkit, Tk.
This has its upsides and its downsides...
cross-platform compatible. See \urlref{this link}{http://www.python.org/download/Contributed.html\#Graphics}
for a listing of a few of them.
cross-platform compatible. See \urlref{this link}{http://www.python.org/download/Contributed.html\#Graphics}
for a listing of a few of them.
\wxheading{First things first...}
I'm not going to try and teach the Python language here. You can do
that at the \urlref{Python Tutorial}{http://www.python.org/doc/tut/tut.html}.
\wxheading{First things first...}
I'm not going to try and teach the Python language here. You can do
that at the \urlref{Python Tutorial}{http://www.python.org/doc/tut/tut.html}.
enough to notice the similarities in the classes used.
Take a look at the following wxPython program. You can find a similar
enough to notice the similarities in the classes used.
Take a look at the following wxPython program. You can find a similar
059: def OnInit(self):
060:
061: # Create an instance of our customized Frame class
062: frame = MyFrame(NULL, -1, "This is a test")
063: frame.Show(true)
064:
059: def OnInit(self):
060:
061: # Create an instance of our customized Frame class
062: frame = MyFrame(NULL, -1, "This is a test")
063: frame.Show(true)
064:
example, "{\tt wx.wxFrame}".
\item At line 13 the frame's sizing and moving events are connected to
methods of the class. These helper functions are intended to be like
example, "{\tt wx.wxFrame}".
\item At line 13 the frame's sizing and moving events are connected to
methods of the class. These helper functions are intended to be like
tables are impossible with wxPython, we use helpers that are named the
same to dynamically build the table. The only real difference is
that the first argument to the event helpers is always the window that
tables are impossible with wxPython, we use helpers that are named the
same to dynamically build the table. The only real difference is
that the first argument to the event helpers is always the window that
have a \_\_del\_\_ method that explicitly causes the C++ object to be
deleted. If you ever have the need to forcibly delete a window, use
the Destroy() method as shown on line 36.
have a \_\_del\_\_ method that explicitly causes the C++ object to be
deleted. If you ever have the need to forcibly delete a window, use
the Destroy() method as shown on line 36.
derived from {\tt wxApp} (line 56) that implements a method named
{\tt OnInit}, (line 59.) This method should create the application's
main window (line 62) and use {\tt wxApp.SetTopWindow()} (line 66) to
derived from {\tt wxApp} (line 56) that implements a method named
{\tt OnInit}, (line 59.) This method should create the application's
main window (line 62) and use {\tt wxApp.SetTopWindow()} (line 66) to
\item And finally, at line 72 an instance of the application class is
created. At this point wxPython finishes initializing itself, and calls
the {\tt OnInit} method to get things started. (The zero parameter here is
\item And finally, at line 72 an instance of the application class is
created. At this point wxPython finishes initializing itself, and calls
the {\tt OnInit} method to get things started. (The zero parameter here is
The following classes are supported in wxPython. Most provide nearly
full implementations of the public interfaces specified in the C++
The following classes are supported in wxPython. Most provide nearly
full implementations of the public interfaces specified in the C++
\item \helpref{wxIndividualLayoutConstraint}{wxindividuallayoutconstraint}
\item \helpref{wxInitDialogEvent}{wxinitdialogevent}
\item \helpref{wxInputStream}{wxinputstream}
\item \helpref{wxIndividualLayoutConstraint}{wxindividuallayoutconstraint}
\item \helpref{wxInitDialogEvent}{wxinitdialogevent}
\item \helpref{wxInputStream}{wxinputstream}
\item \helpref{wxValidator}{wxvalidator}
\item \helpref{wxWindowDC}{wxwindowdc}
\item \helpref{wxWindow}{wxwindow}
\item \helpref{wxValidator}{wxvalidator}
\item \helpref{wxWindowDC}{wxwindowdc}
\item \helpref{wxWindow}{wxwindow}