Package fife :: Package extensions :: Package pychan :: Module autoposition
[hide private]
[frames] | no frames]

Module autoposition

source code

Automatic widget positioning

You can use the position_techinque attribute on top level widgets which can also be set from xml.

For direct use call placeWidget.

Functions [hide private]
 
_splicePosition(p) source code
 
_parsePosition(position) source code
 
placeWidget(widget, position)
Place a widget according to a string defining relative coordinates to screen borders.
source code
Variables [hide private]
  EXPLICIT = "explicit"
  AUTOMATIC = "automatic"
  TOP = "top"
  LEFT = "left"
  RIGHT = "right"
  CENTER = "center"
  BOTTOM = "bottom"
Function Details [hide private]

placeWidget(widget, position)

source code 

Place a widget according to a string defining relative coordinates to screen borders.

The position definition has to be of the form: "<x_pos><x_delta>:<y_pos><y_delta>"

<x_pos> may be one of:

  • left
  • right
  • center
  • explicit

<y_pos> may be one of:

  • top
  • bottom
  • center
  • explicit

explicit means that the widgets x or y position will not be touched. The rest should be self explanatory.

<x_delta> and <y_delta> must be of the form: +pixel_number or -pixel_number. Or comletely omitted. Note that the sign has to be there for for positive deltas, too.

For brevity two shortcuts exist:

  • "explict" -> "explict:explict"
  • "automatic" -> "center:center"

A few examples:

 "right-20:top"
 "center:top+10"
 "center:center"
Parameters:
  • widget - The PyChan widget.
  • position - A position definition.

    If the position cannot be parsed a PyChanException is thrown.