docs/widget.rst
author Radek Brich <radek.brich@devl.cz>
Wed, 17 Aug 2011 21:11:47 +0200
changeset 10 ec1d47e6fe09
parent 5 ae128c885d0f
child 12 bb7d41be0c44
permissions -rw-r--r--
Use isinstance instead of type.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     1
Widget
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     2
======
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     3
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     4
.. toctree::
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     5
   :maxdepth: 2
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     6
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     7
   container
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     8
   button
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     9
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    10
Class attributes
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    11
----------------
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    12
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    13
.. attribute:: Widget.parent
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    14
5
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    15
   Parrent widget.
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    16
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    17
2
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    18
.. attribute:: Widget.top
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    19
5
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    20
   Top widget (same for every widget in one application).
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    21
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    22
2
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    23
.. attribute:: Widget.x
5
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    24
               Widget.y
2
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    25
5
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    26
   Position inside parent widget. Modified by layout manager.
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    27
2
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    28
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    29
.. attribute:: Widget.width
5
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    30
               Widget.height
2
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    31
5
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    32
   Actual size. Modified by layout manager.
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    33
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    34
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    35
.. attribute:: Widget.sizemin
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    36
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    37
   Minimal size of widget. Under normal circumstances, widget will never be sized smaller than this.
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    38
   Tuple (w, h). Both must be integers >= 1.
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    39
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    40
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    41
.. attribute:: Widget.sizemax
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    42
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    43
   Maximum size of widget. Widget will never be sized bigger than this.
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    44
   Tuple (w, h). Integers >= 1 or None (meaning no maximum size or infinite).
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    45
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    46
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    47
.. attribute:: Widget.sizereq
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    48
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    49
   Size request. This is default size of the widget. Will be fulfilled if possible.
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    50
   Tuple (w, h). Integers >= 1 or None (meaning use minumal size).
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    51
2
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    52
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    53
.. attribute:: Widget.hidden
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    54
5
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    55
   Hidden widget does not affect layout.
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    56
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    57
2
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    58
.. attribute:: Widget.allowlayout
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    59
5
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    60
   When false, the widget is not considered in layout.
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    61
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    62
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    63
.. attribute:: Widget.layouthints
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    64
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    65
   Dictionary containing optional parameters for layout managers.
ae128c885d0f New GridLayout. Change cursor behavior (hide on unfocus event). Change resize event to propagate through containers. Change container clipping - allowlayout=false children are clipped without borders. More Widget doc.
Radek Brich <radek.brich@devl.cz>
parents: 2
diff changeset
    66
2
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    67
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    68
Event management
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    69
----------------
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    70
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    71
.. classmethod:: Widget.newevent(event)
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    72
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    73
   Create new event with empty handler list.
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    74
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    75
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    76
.. classmethod:: Widget.connect(event, handler)
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    77
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    78
   Add handler to handler list of the event.
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    79
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    80
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    81
.. classmethod:: Widget.disconnect(event, handler=None)
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    82
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    83
   Remove handler from event's handler list. If no handler is given, remove all handlers.
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    84
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    85
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    86
.. classmethod:: Widget.handle(event, ...)
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    87
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    88
   Call all handlers from event's handler list.
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    89
   This is used when user defined handlers are to be called.
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    90
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    91
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    92
.. classmethod:: Widget.emit(event, ...)
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    93
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    94
   Emit event.
684cdc352562 Menu, Window and other improvements.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    95
   This is used by original event source when the event is detected.