X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7fa23c09cdf8b4cbccf730a6e53c7688f79d250b..f18eaf2687ab42c97ccf469a2617306cadc0c6ef:/wxPython/docs/wxPythonManual.html diff --git a/wxPython/docs/wxPythonManual.html b/wxPython/docs/wxPythonManual.html index c23448f728..be394c9c24 100644 --- a/wxPython/docs/wxPythonManual.html +++ b/wxPython/docs/wxPythonManual.html @@ -3,7 +3,7 @@ - + The wxPython Manual @@ -32,8 +32,8 @@ -
-

Contents

+
+

Contents

-
-

Introduction

+
+

Introduction

This is a guide to the wxPython GUI toolkit, written by a Python programmer for his fellow Python programmers. It began as a simple translation of the wxWidgets documentation (which is written @@ -108,8 +108,8 @@ beans, dark chocolate, and large denomination currency. Better yet, buy huge quantities of my wxPython book (written with Robin Dunn) and send one to each of your friends, relatives, and coworkers.

-
-

What is wxPython?

+
+

What is wxPython?

wxPython is a GUI toolkit for the Python programming language. It allows Python programmers to create programs with a robust, highly functional graphical user interface, simply and easily. It is @@ -126,19 +126,19 @@ or unix-like systems, and Macintosh OS X.

Since the language is Python, wxPython programs are simple, easy to write and easy to understand.

-
-

wxPython requirements

+
+

wxPython requirements

To make use of wxPython, you currently need one of the following setups.

-
-

MS-Windows

+
+

MS-Windows

  • A 486 or higher PC running MS Windows.
  • At least ?? MB of disk space.
-
-

Linux or Unix

+
+

Linux or Unix

  • Almost any C++ compiler, including GNU C++ (EGCS 1.1.1 or above).
  • Almost any Unix workstation, and one of: GTK+ 1.2, GTK+ 2.0, Motif @@ -146,16 +146,16 @@ setups.

  • At least ?? MB of disk space.
-
-

Mac OS X

+
+

Mac OS X

  • A PowerPC Mac running Mac OS X 10.x.
  • At least ?? MB of disk space.
-
-

What is wxWidgets?

+
+

What is wxWidgets?

wxWidgets is a C++ framework providing GUI (Graphical User Interface) and other facilities on more than one platform. Version 2 currently supports all desktop versions of MS Windows, Unix with GTK+, Unix with @@ -169,8 +169,8 @@ Roebling, Vadim Zeitlin, Vaclav Slavik and many others.

platforms related to Microsoft Windows, including 16-bit and 32-bit variants, unless otherwise stated. All trademarks are acknowledged.

-
-

Why another cross-platform development tool?

+
+

Why another cross-platform development tool?

wxWidgets was developed to provide a cheap and flexible way to maximize investment in GUI application development. While a number of commercial class libraries already existed for cross-platform @@ -244,8 +244,8 @@ the clipboard. PNM, PCX).

-
-

wxPython Overview

+
+

wxPython Overview

To set a wxPython application going, you will need to derive an App class and override App.OnInit.

An application must have a top-level Frame or Dialog window. Each @@ -291,14 +291,14 @@ PathList. There's a miscellany of operating system and other functions.

See also Classes by Category for a list of classes.

-
-

Utilities and libraries supplied with wxPython

+
+

Utilities and libraries supplied with wxPython

In addition to the core wxWidgets library, a number of further libraries and utilities are supplied with each distribution.

[Need to list these.]

-
-

Creating and deleting wxPython objects

+
+

Creating and deleting wxPython objects

[This section needs to be reviewed.]

-
-

App overview

+
+

App overview

Classes: wx.App

-
-

Application initialization

+
+

Application initialization

The OnInit method defined for a class derived from wx.App will usually create a top window as a bare minimum.

OnInit must return a boolean value to indicate whether processing @@ -365,8 +365,8 @@ if __name__ == '__main__': main()

-
-

Application shutdown

+
+

Application shutdown

The application normally shuts down when the last of its top level windows is closed. This is normally the expected behaviour and means that it is enough to call Close() in response to the "Exit" menu @@ -385,11 +385,11 @@ created by the time OnExit finishes.

[Need examples of objects needing cleanup to keep app from crashing.]

-
-

Sizer overview

+
+

Sizer overview

Classes: wx.Sizer, wx.GridSizer, wx.FlexGridSizer, wx.BoxSizer, wx.StaticBoxSizer, wx.NotebookSizer, wx.CreateButtonSizer

- +
@@ -425,8 +425,8 @@ individual controls. Editors such as wxDesigner, wxrcedit, XRCed and wxWorkshop create dialogs based exclusively on sizers, practically forcing the user to create platform independent layouts without compromises.

-
-

The idea behind sizers

+
+

The idea behind sizers

The layout algorithm used by sizers in wxPython is closely related to layout systems in other GUI toolkits, such as Java's AWT, the GTK toolkit or the Qt toolkit. It is based upon the idea of individual @@ -453,15 +453,15 @@ in a dialog or it fulfils a special task such as wrapping a static box around a dialog item (or another sizer). These sizers will be discussed one by one in the text below.

-
-

Common features

+
+

Common features

All sizers are containers, that is, they are used to lay out one dialog item (or several dialog items), which they contain. Such items are sometimes referred to as the children of the sizer. Independent of how the individual sizers lay out their children, all children have certain features in common:

-
-

A minimal size

+
+

A minimal size

This minimal size is usually identical to the initial size of the controls and may either be set explicitly in the size field of the control constructor or may be calculated by wxPython, typically by @@ -472,8 +472,8 @@ thus require an explicit size. Some controls can calculate their height, but not their width (e.g. a single line text control):

[Need graphics]

-
-

A border

+
+

A border

The border is just empty space and is used to separate dialog items in a dialog. This border can either be all around, or at any combination of sides such as only above and below the control. The thickness of @@ -482,8 +482,8 @@ samples show dialogs with only one dialog item (a button) and a border of 0, 5, and 10 pixels around the button:

[Need graphics]

-
-

An alignment

+
+

An alignment

Often, a dialog item is given more space than its minimal size plus its border. Depending on what flags are used for the respective dialog item, the dialog item can be made to fill out the available space @@ -494,8 +494,8 @@ three buttons in a horizontal box sizer; one button is centred, one is aligned at the top, one is aligned at the bottom:

[Need graphics]

-
-

A stretch factor

+
+

A stretch factor

If a sizer contains more than one child and it is offered more space than its children and their borders need, the question arises how to distribute the surplus space among the children. For this purpose, a @@ -513,8 +513,8 @@ have a stretch factor of zero and keep their initial width:

Within wxDesigner, this stretch factor gets set from the Option menu.

-
-

BoxSizer

+
+

BoxSizer

BoxSizer can lay out its children either vertically or horizontally, depending on what flag is being used in its constructor. When using a vertical sizer, each child can be centered, aligned to the right or @@ -527,14 +527,14 @@ horizontally. The following sample shows the same dialog as in the last sample, only the box sizer is a vertical box sizer now:

[Need graphics]

-
-

StaticBoxSizer

+
+

StaticBoxSizer

StaticBoxSixer is the same as a BoxSizer, but surrounded by a static box. Here is a sample:

[Need graphics]

-
-

GridSizer

+
+

GridSizer

GridSizer is a two-dimensional sizer. All children are given the same size, which is the minimal size required by the biggest child, in this case the text control in the left bottom border. Either the number of @@ -542,8 +542,8 @@ columns or the number or rows is fixed and the grid sizer will grow in the respectively other orientation if new children are added:

[Need graphics]

-
-

FlexGridSizer

+
+

FlexGridSizer

Another two-dimensional sizer derived from GridSizer. The width of each column and the height of each row are calculated individually according the minimal requirements from the respectively biggest @@ -553,16 +553,16 @@ it requested. The following sample shows the same dialog as the one above, but using a flex grid sizer:

[Need graphics]

-
-

NotebookSizer

+
+

NotebookSizer

NotebookSizer can be used with notebooks. It calculates the size of each notebook page and sets the size of the notebook to the size of the biggest page plus some extra space required for the notebook tabs and decorations.

[Need graphics]

-
-

Programming with BoxSizer

+
+

Programming with BoxSizer

The basic idea behind a BoxSizer is that windows will most often be laid out in rather simple basic geometry, typically in a row or a column or several hierarchies of either.

@@ -601,30 +601,30 @@ wx.GROW flag is not used, the item can be aligned within available space. wx.ALIGN_LEFT, wx.ALIGN_TOP, wx.ALIGN_RIGHT, wx.ALIGN_BOTTOM, wx.ALIGN_CENTER_HORIZONTAL and wx.ALIGN_CENTER_VERTICAL do what they say. wx.ALIGN_CENTRE (same as wx.ALIGN_CENTER) is defined as -(wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL). Default -alignment is wx.ALIGN_LEFT | wx.ALIGN_TOP.

+(wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL). Default +alignment is wx.ALIGN_LEFT | wx.ALIGN_TOP.

As mentioned above, any window belonging to a sizer may have border, and it can be specified which of the four sides may have this border, using the wx.TOP, wx.LEFT, wx.RIGHT and wx.BOTTOM constants or wx.ALL for all directions (and you may also use wx.NORTH, wx.WEST etc instead). These flags can be used in combination with the alignment flags above as the second parameter of the Add() method using the -binary or operator (|). The sizer of the border also must be made +binary or operator (|). The sizer of the border also must be made known, and it is the third parameter in the Add() method. This means, that the entire behaviour of a sizer and its children can be controlled by the three parameters of the Add() method.

[Show code and graphic here.]

-
-

Programming with GridSizer

+
+

Programming with GridSizer

GridSizer is a sizer which lays out its children in a two-dimensional table with all table fields having the same size, i.e. the width of each field is the width of the widest child, the height of each field is the height of the tallest child.

[Show code and graphic here.]

-
-

Programming with FlexGridSizer

+
+

Programming with FlexGridSizer

FlexGridSizer is a sizer which lays out its children in a two-dimensional table with all table fields in one row having the same height and all fields in one column having the same width, but all @@ -632,8 +632,8 @@ rows or all columns are not necessarily the same height or width as in the GridSizer.

[Show code and graphic here.]

-
-

Programming with NotebookSizer

+
+

Programming with NotebookSizer

NotebookSizer is a specialized sizer to make sizers work in connection with using notebooks. This sizer is different from any other sizer as you must not add any children to it - instead, it queries the notebook @@ -648,20 +648,20 @@ one example showing how to add a notebook page that the notebook sizer is aware of:

[Show code and graphic here.]

-
-

Programming with StaticBoxSizer

+
+

Programming with StaticBoxSizer

StaticBoxSizer is a sizer derived from BoxSizer but adds a static box around the sizer. Note that this static box has to be created separately.

[Show code and graphic here.]

-
-

Dialog.CreateButtonSizer

+
+

Dialog.CreateButtonSizer

As a convenience, the Dialog class has a CreateButtonSizer(flags) method that can be used to create a standard button sizer in which standard buttons are displayed. The following flags can be passed to this method:

-
+
@@ -705,11 +705,11 @@ wx.OK button will be default
-
-

Date and time classes overview

+
+

Date and time classes overview

wxPython provides a set of powerful classes to work with dates and times. Some of the supported features of the DateTime class are:

- +
@@ -737,8 +737,8 @@ with them is fast
-
-

All date/time classes at a glance

+
+

All date/time classes at a glance

There are 3 main classes: except DateTime itself which represents an absolute moment in time, there are also two classes - TimeSpan and DateSpan which represent the intervals of time.

@@ -748,8 +748,8 @@ date is a holiday or not and DateTimeWorkDays which is a derivation of this class for which (only) Saturdays and Sundays are the holidays. See more about these classes in the discussion of the holidays.

-
-

DateTime characteristics

+
+

DateTime characteristics

DateTime stores the time as a signed number of milliseconds since the Epoch which is fixed, by convention, to Jan 1, 1970 - however this is not visible to the class users (in particular, dates prior to the @@ -772,8 +772,8 @@ country, and even region, dependent). Future versions will probably have Julian calendar support as well and support for other calendars (Maya, Hebrew, Chinese...) is not ruled out.

-
-

Difference between DateSpan and TimeSpan

+
+

Difference between DateSpan and TimeSpan

While there is only one logical way to represent an absolute moment in the time (and hence only one DateTime class), there are at least two methods to describe a time interval.

@@ -801,14 +801,14 @@ in the program, you should probably use TimeSpan instead of DateSpan in situations when you do need to understand what 'in a month' means (of course, it is just DateTime.Now() + DateSpan.Month()).

-
-

Date arithmetics

+
+

Date arithmetics

Many different operations may be performed with the dates, however not all of them make sense. For example, multiplying a date by a number is an invalid operation, even though multiplying either of the time span classes by a number is perfectly valid.

Here is what can be done:

- +
@@ -838,8 +838,8 @@ opposite time direction.
-
-

Time zone considerations

+
+

Time zone considerations

Although the time is always stored internally in GMT, you will usually work in the local time zone. Because of this, all DateTime constructors and setters which take the broken down date assume that @@ -877,8 +877,8 @@ job. I.e. you would just write

printf("The time is %s in local time zone", dt.FormatTime().c_str()); printf("The time is %s in GMT", dt.FormatTime(wxDateTime::GMT).c_str());

-
-

Daylight saving time (DST)

+
+

Daylight saving time (DST)

DST (a.k.a. 'summer time') handling is always a delicate task which is better left to the operating system which is supposed to be configured by the administrator to behave correctly. Unfortunately, when doing @@ -894,17 +894,17 @@ the future.

The time zone handling methods use these functions too, so they are subject to the same limitations.

- -
-

Classes by category

+
+

Classes by category

Not done yet.

-
-

ID constants

+
+

ID constants

wxPython provides the following predefined ID constants:

ID_ABORT ID_ABOUT @@ -964,8 +964,8 @@ ID_UNDO ID_YES ID_YESTOALL

-
-

Source document

+
+

Source document

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 @@ -973,8 +973,8 @@ 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

+
+

Submitting changes to the source document

Some items in the source text file look like this:

 .. This is text from the wxWidgets documentation that needs to be
@@ -991,8 +991,8 @@ to you and will show my gratitude by adding your name to the list of
 contributors.  (Contributors who also send me gifts of coffee,
 chocolate, or currency will have their names listed in bold.)

-
-

Contributors

+
+

Contributors

Individuals who contributed to this documentation (in order by last name):

    @@ -1003,8 +1003,8 @@ name):

  • Vadim Zeitlin
-
-

License

+
+

License

This document began as a translation of the wxWidgets documentation. As such, it adheres to the same license, which is provided here: