Updated.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20477 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -8,23 +8,22 @@
|
||||
|
||||
:Author: Patrick K. O'Brien
|
||||
:Contact: pobrien@orbtech.com
|
||||
:Organization: Orbtech_
|
||||
:Date: $Date$
|
||||
:Revision: $Revision$
|
||||
|
||||
.. _Orbtech: http://www.orbtech.com/
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
.. Add a link to wxExamples.html
|
||||
|
||||
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
Big things sometimes come in small packages. This is certainly true
|
||||
of the new wx package, which is being introduced as a transition to
|
||||
allow the "wx" prefix to be dropped from the names of all wxPython
|
||||
classes, functions, and constants.
|
||||
of the new wx package, which is being introduced as a way to allow the
|
||||
"wx" prefix to be dropped from the names of all wxPython classes,
|
||||
functions, and constants.
|
||||
|
||||
|
||||
Why change anything?
|
||||
@@ -127,18 +126,18 @@ Again, the technique is very similar to the one used by the wx
|
||||
package.
|
||||
|
||||
|
||||
How do I use it?
|
||||
================
|
||||
How do I use this new wx package?
|
||||
=================================
|
||||
|
||||
The wx package is created when you install wxPython. So you can start
|
||||
using it now. Examples are included in the wx/examples directory,
|
||||
which includes an examples.txt documentation file. Here is the source
|
||||
code for ``hello.py``, a simple program that displays a wxPython
|
||||
graphic inside a frame:
|
||||
The wx package is automatically created when you install wxPython
|
||||
version 2.4.1 or higher. So all you have to do is::
|
||||
|
||||
.. include:: ../samples/wx_examples/hello/hello.py
|
||||
:literal:
|
||||
import wx
|
||||
|
||||
Example programs are included in the wxPython/samples/wx_examples
|
||||
directory, and are documented in the wxPythonExamples_ documentation
|
||||
file.
|
||||
|
||||
.. _wxPythonExamples: wxPythonExamples.html
|
||||
|
||||
Good luck. I hope you like the new wx package as much as I do.
|
||||
|
||||
Pat
|
||||
|
@@ -8,15 +8,26 @@
|
||||
|
||||
:Author: Patrick K. O'Brien
|
||||
:Contact: pobrien@orbtech.com
|
||||
:Organization: Orbtech_
|
||||
:Date: $Date$
|
||||
:Revision: $Revision$
|
||||
|
||||
.. _Orbtech: http://www.orbtech.com/
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
This document illustrates example programs using wxPython. All the
|
||||
examples make use of the new wx package syntax, which is a bit
|
||||
different than older examples you might come across.
|
||||
|
||||
|
||||
Background (with tongue firmly in cheek)
|
||||
========================================
|
||||
|
||||
If something hits you on the head, don't run around screaming that the
|
||||
sky is falling. Instead, take a close look and see if it wasn't a
|
||||
"wx" prefix that hit you. Apparently, they're dropping off wxPython
|
||||
@@ -30,7 +41,7 @@ dust. I think it's for the best. But, being the kind, considerate
|
||||
person that I am, I decided to write this guide to make the wx
|
||||
namespace transition easier for everyone, even Chicken Little.
|
||||
|
||||
.. sidebar:: Say what?
|
||||
.. note:: Say what?
|
||||
|
||||
If you have no idea what I mean by the "wx namespace transition,"
|
||||
consider yourself lucky. You can simply use these examples to
|
||||
@@ -39,24 +50,30 @@ namespace transition easier for everyone, even Chicken Little.
|
||||
folks (including me) considered ugly. So we changed it. And
|
||||
that's when the sky starting falling...
|
||||
|
||||
If you want more of the technical details, read the `wx package
|
||||
documentation`_.
|
||||
|
||||
.. _wx package documentation: wxPackage.html
|
||||
|
||||
|
||||
Rather than simply **tell** you that everything will be okay, I
|
||||
decided to **show** you that everything will be okay. To do that,
|
||||
I've created a bunch of example programs using the new wx package. I
|
||||
hope you like them.
|
||||
|
||||
|
||||
Basic
|
||||
=====
|
||||
Basic Program Example
|
||||
=====================
|
||||
|
||||
It doesn't get much simpler than this. Every wxPython program needs
|
||||
an application and a frame. To encourage good coding habits, I've
|
||||
split them into separate modules. They don't do much, but they're a
|
||||
good starting point.
|
||||
|
||||
I include a simple App class in the frame module because the PyCrust
|
||||
"wrapper" utility (``wrap.py``) only works with modules that contain
|
||||
an application class. So including a simple one in each of your frame
|
||||
modules allows you to use the PyCrust runtime wrapper and debug your
|
||||
I include a simple App class in the frame module because the PyWrap
|
||||
"wrapper" utility (``pywrap``) only works with modules that contain an
|
||||
application class. So including a simple one in each of your frame
|
||||
modules allows you to use the PyWrap runtime wrapper and debug your
|
||||
frames independent of your full application.
|
||||
|
||||
Here is the module (``frame.py``) that defines the frame class:
|
||||
@@ -71,8 +88,8 @@ and imports the frame from ``frame.py``:
|
||||
:literal:
|
||||
|
||||
|
||||
Hello
|
||||
=====
|
||||
Hello wxPython Example
|
||||
======================
|
||||
|
||||
This program displays an image file (``wxPython.jpg``) inside a frame
|
||||
sized to match the graphic.
|
||||
@@ -94,6 +111,6 @@ sized to match the graphic.
|
||||
|
||||
Here is the source code for ``hello.py``:
|
||||
|
||||
.. include:: hello/hello.py
|
||||
.. include:: ../samples/wx_examples/hello/hello.py
|
||||
:literal:
|
||||
|
||||
|
@@ -2,16 +2,19 @@
|
||||
The wxPython Manual
|
||||
=====================
|
||||
|
||||
--------------------------------------------------------
|
||||
A guide to the wxPython toolkit for Python programmers
|
||||
--------------------------------------------------------
|
||||
--------------------------------------------
|
||||
A guide to wxPython for Python programmers
|
||||
--------------------------------------------
|
||||
|
||||
:Author: Patrick K. O'Brien
|
||||
:Contact: pobrien@orbtech.com
|
||||
:Organization: Orbtech_
|
||||
:Date: $Date$
|
||||
:Revision: $Revision$
|
||||
:License: wxWindows Free Documentation Licence, Version 3
|
||||
|
||||
.. _Orbtech: http://www.orbtech.com/
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
@@ -983,15 +986,20 @@ ID_YES
|
||||
ID_YESTOALL
|
||||
|
||||
|
||||
Source Document
|
||||
Source document
|
||||
===============
|
||||
|
||||
The source document is named wxPython.txt and is located in the
|
||||
PyCrust/wxd directory. It is written using a fantastic formatting
|
||||
convention called reStructuredText. The wxPython.html file is created
|
||||
The source document is named wxPythonManual.txt and can be found by
|
||||
clicking the link at the bottom of this page (assuming you are viewing
|
||||
the html file). It is written using a fantastic formatting convention
|
||||
called reStructuredText. The wxPythonManual.html file is created
|
||||
using the Docutils utilities, which can turn reStructuredText
|
||||
documents into html, xml, pdf, and even OpenOffice files.
|
||||
|
||||
|
||||
Submitting changes to the source document
|
||||
=========================================
|
||||
|
||||
Some items in the source text file look like this::
|
||||
|
||||
.. This is text from the wxWindows documentation that needs to be
|
||||
@@ -1028,5 +1036,5 @@ License
|
||||
This document began as a translation of the wxWindows documentation.
|
||||
As such, it adheres to the same license, which is provided here:
|
||||
|
||||
.. include:: ../license/licendoc.txt
|
||||
.. include:: ../licence/licendoc.txt
|
||||
:literal:
|
||||
|
@@ -2,16 +2,19 @@
|
||||
The wxPython Tutorial
|
||||
=======================
|
||||
|
||||
-----------------------------------------------------
|
||||
How to get up and running with the wxPython toolkit
|
||||
-----------------------------------------------------
|
||||
-----------------------------------------
|
||||
How to get up and running with wxPython
|
||||
-----------------------------------------
|
||||
|
||||
:Author: Patrick K. O'Brien
|
||||
:Contact: pobrien@orbtech.com
|
||||
:Organization: Orbtech_
|
||||
:Date: $Date$
|
||||
:Revision: $Revision$
|
||||
:License: wxWindows Free Documentation Licence, Version 3
|
||||
|
||||
.. _Orbtech: http://www.orbtech.com/
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
@@ -35,5 +38,5 @@ License
|
||||
This document adheres to the same license as the other documentation
|
||||
that comes with wxWindows:
|
||||
|
||||
.. include:: ../license/licendoc.txt
|
||||
.. include:: ../licence/licendoc.txt
|
||||
:literal:
|
||||
|
Reference in New Issue
Block a user