docs/widget.rst
author Radek Brich <radek.brich@devl.cz>
Wed, 13 Apr 2011 01:33:27 +0200
changeset 7 d4a291b31cbb
parent 5 ae128c885d0f
child 12 bb7d41be0c44
permissions -rw-r--r--
New color management - named colors.

Widget
======

.. toctree::
   :maxdepth: 2

   container
   button

Class attributes
----------------

.. attribute:: Widget.parent

   Parrent widget.


.. attribute:: Widget.top

   Top widget (same for every widget in one application).


.. attribute:: Widget.x
               Widget.y

   Position inside parent widget. Modified by layout manager.


.. attribute:: Widget.width
               Widget.height

   Actual size. Modified by layout manager.


.. attribute:: Widget.sizemin

   Minimal size of widget. Under normal circumstances, widget will never be sized smaller than this.
   Tuple (w, h). Both must be integers >= 1.


.. attribute:: Widget.sizemax

   Maximum size of widget. Widget will never be sized bigger than this.
   Tuple (w, h). Integers >= 1 or None (meaning no maximum size or infinite).


.. attribute:: Widget.sizereq

   Size request. This is default size of the widget. Will be fulfilled if possible.
   Tuple (w, h). Integers >= 1 or None (meaning use minumal size).


.. attribute:: Widget.hidden

   Hidden widget does not affect layout.


.. attribute:: Widget.allowlayout

   When false, the widget is not considered in layout.


.. attribute:: Widget.layouthints

   Dictionary containing optional parameters for layout managers.


Event management
----------------

.. classmethod:: Widget.newevent(event)

   Create new event with empty handler list.


.. classmethod:: Widget.connect(event, handler)

   Add handler to handler list of the event.


.. classmethod:: Widget.disconnect(event, handler=None)

   Remove handler from event's handler list. If no handler is given, remove all handlers.


.. classmethod:: Widget.handle(event, ...)

   Call all handlers from event's handler list.
   This is used when user defined handlers are to be called.


.. classmethod:: Widget.emit(event, ...)

   Emit event.
   This is used by original event source when the event is detected.