X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2cd3cc948ea512eba91032323fe32207ac74bf8e..7447d53c35249d42128d6243c90998f03882859a:/docs/doxygen/overviews/python.h diff --git a/docs/doxygen/overviews/python.h b/docs/doxygen/overviews/python.h index 71b1d25ff8..04dde37b1d 100644 --- a/docs/doxygen/overviews/python.h +++ b/docs/doxygen/overviews/python.h @@ -3,14 +3,15 @@ // Purpose: topic overview // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -/*! +/** @page overview_python wxPython Overview -This topic was written by Robin Dunn, author of the wxPython wrapper. +This topic was written by Robin Dunn, author of the +wxPython wrapper. @li @ref overview_python_what @li @ref overview_python_why @@ -120,19 +121,19 @@ pieces you need without having to use the GUI portions. There are quite a few other GUI modules available for Python, some in active use, some that haven't been updated for ages. Most are simple wrappers around some C or C++ toolkit or another, and most are not cross-platform compatible. -See http://pypi.python.org/pypi?:action=browse&show=all&c=433 for a listing of -a few of them. +See this link +for a listing of a few of them. @section overview_python_using Using wxPython I'm not going to try and teach the Python language here. You can do that at the -. I'm also going to assume that you -know a bit about wxWidgets already, enough to notice the similarities in the -classes used. +Python Tutorial. I'm also +going to assume that you know a bit about wxWidgets already, enough to notice +the similarities in the classes used. Take a look at the following wxPython program. You can find a similar program -in the wxPython/demo directory, named "DialogUnits.py". If your Python and +in the @c wxPython/demo directory, named @c DialogUnits.py. If your Python and wxPython are properly installed, you should be able to run it by issuing this command: @@ -205,8 +206,6 @@ python DialogUnits.py 62: frame = MyFrame(NULL, -1, "This is a test") 63: frame.Show(true) 64: -65: # Tell wxWidgets that this is our main window -66: self.SetTopWindow(frame) 67: 68: # Return a success flag 69: return true @@ -221,8 +220,8 @@ python DialogUnits.py At line 2 the wxPython classes, constants, and etc. are imported into the current module's namespace. If you prefer to reduce namespace pollution you can -use "from wxPython import wx" and then access all the wxPython identifiers -through the wx module, for example, "wx.wxFrame". +use @c "from wxPython import wx" and then access all the wxPython identifiers +through the wx module, for example, @c "wx.wxFrame". 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 the event table macros @@ -235,13 +234,13 @@ Notice the use of @c wxDLG_PNT and @c wxDLG_SZE in lines 19-29 to convert from dialog units to pixels. These helpers are unique to wxPython since Python can't do method overloading like C++. -There is an @c OnCloseWindow method at line 34 but no call to EVT_CLOSE to +There is an @c OnCloseWindow method at line 34 but no call to @c EVT_CLOSE to attach the event to the method. Does it really get called? The answer is, yes it does. This is because many of the standard events are attached to windows that have the associated standard method names. I have tried to follow the lead of the C++ classes in this area to determine what is standard but since that changes from time to time I can make no guarantees, nor will it be fully -documented. When in doubt, use an EVT_*** function. +documented. When in doubt, use an @c EVT_*** function. At lines 17 to 21 notice that there are no saved references to the panel or the static text items that are created. Those of you who know Python might be @@ -250,14 +249,13 @@ scope. Do they disappear from the GUI? They don't. Remember that in wxPython the Python objects are just shadows of the corresponding C++ objects. Once the C++ windows and controls are attached to their parents, the parents manage them and delete them when necessary. For this reason, most wxPython objects do not -need to have a __del__ method that explicitly causes the C++ object to be +need to have a @c __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. Just like wxWidgets in C++, wxPython apps need to create a class derived from @c wxApp (line 56) that implements a method named @c OnInit, (line 59.) This -method should create the application's main window (line 62) and use -wxApp.SetTopWindow() (line 66) to inform wxWidgets about it. +method should create the application's main window (line 62) and show it. And finally, at line 72 an instance of the application class is created. At this point wxPython finishes initializing itself, and calls the @c OnInit @@ -300,7 +298,7 @@ spec over time. @li wxColour @li wxComboBox @li wxCommandEvent -@li wxConfig +@li wxConfigBase @li wxControl @li wxCursor @li wxCustomDataObject @@ -355,7 +353,7 @@ spec over time. @li wxIndividualLayoutConstraint @li wxInitDialogEvent @li wxInputStream -@li wxInternetFSHandler +@li @ref wxFileSystem "wxInternetFSHandler" @li wxJoystickEvent @li wxJPEGHandler @li wxKeyEvent @@ -377,7 +375,7 @@ spec over time. @li wxMenuItem @li wxMenu @li wxMessageDialog -@li wxMetaFileDC +@li wxMetafileDC @li wxMiniFrame @li wxMouseEvent @li wxMoveEvent @@ -415,7 +413,7 @@ spec over time. @li wxScreenDC @li wxScrollBar @li wxScrollEvent -@li wxScrolledWindow +@li ::wxScrolledWindow @li wxScrollWinEvent @li wxShowEvent @li wxSingleChoiceDialog @@ -454,7 +452,7 @@ spec over time. @li wxValidator @li wxWindowDC @li wxWindow -@li wxZipFSHandler +@li @ref wxFileSystem "wxZipFSHandler" @section overview_python_help Where to Go for Help