Package ocempgui :: Package widgets :: Module Container :: Class Container
[show private | hide private]
[frames | no frames]

Type Container

 object --+            
          |            
INotifyable --+        
              |        
     BaseObject --+    
                  |    
     object --+   |    
              |   |    
         Sprite --+    
                  |    
         BaseWidget --+
                      |
                     Container

Known Subclasses:
Box, Frame, StatusBar, Table

Container () -> Container

A container widget class, which can hold multiple other widgets.

The Container class is an abstract class, which can hold multiple
widgets. It is usable to serve as container for various types of
widgets and allows inheritors to use their own look.

The 'children' attribute is a list of the widgets added to the
Container.

children = container.children           # get the list of children
container.add_child (widget)            # add a widget
container.add_child (widget1, widget2)  # add multiple widgets at once
container.remove_child (widget)         # remove a widget
container.children = my_list_of_widgets # Set multiple widgets at once.

The 'padding' attribute and set_padding() method are used to place a
certain amount of pixels between the children and the outer edges of
the Container.

container.padding = 10
container.set_padding (10)

An additional amount of pixels can be placed between the widgets
using the 'spacing' attribute or set_spacing() method. Dependant on
the inherited Container class, this places the given amount of
pixels between the children.

container.spacing = 10
container.set_spacing (10)

Default action (invoked by activate()):
None

Mnemonic action (invoked by activate_mnemonic()):
None

Attributes:
children - List of widgets packed into the Container.
spacing  - Spacing in pixels between the children.
padding  - Padding between the borders and the children of the
           Container.

Method Summary
  __init__(self)
  add_child(self, *children)
C.add_child (...) -> None
  calculate_size(self)
C.calculate_size (...) -> int, int
  destroy(self)
C.destroy () -> None
  dispose_widgets(self)
C.dispose_widgets (...) -> None
  insert_child(self, pos, *children)
C.insert_child (...) -> None
  remove_child(self, child)
C.remove_child (...) -> None
  set_children(self, children)
C.set_children (...) -> None
  set_depth(self, depth)
C.set_depth (...) -> None
  set_event_manager(self, manager)
C.set_event_manager (...) -> None
  set_indexable(self, indexable)
C.set_indexable (...) -> None
  set_padding(self, padding)
C.set_padding (...) -> None
  set_sensitive(self, sensitive)
C.set_sensitive (...) -> None
  set_spacing(self, spacing)
C.set_spacing (...) -> None
  update(self, **kwargs)
C.update (...) -> None
  _add(self, **kwargs)
C._add (...) -> None
    Inherited from BaseWidget
  activate(self)
W.activate () -> None
  activate_mnemonic(self, mnemonic)
W.activate_mnemonic (...) -> bool
  check_sizes(self, width, height)
W.check_sizes (...) -> int, int
  create_style(self)
W.create_style () -> WidgetStyle
  debug_update(self)
For debugging usage only
  draw(self)
W.draw () -> None
  draw_bg(self)
W.draw_bg () -> Surface
  get_style(self)
W.get_style () -> WidgetStyle
  initclass(cls)
B.initclass () -> None (Class method)
  lock(self)
W.lock () -> None
  notify(self, event)
W.notify (...) -> None
  rect_to_client(self, rect)
W.rect_to_client (...) -> pygame.Rect
  set_dirty(self, dirty, update)
W.set_dirty (...) -> None
  set_entered(self, entered)
W.set_entered (...) -> None
  set_event_area(self, area)
W.set_event_area (...) -> None
  set_focus(self, focus)
W.set_focus (...) -> bool
  set_index(self, index)
W.set_index (...) -> None
  set_maximum_size(self, width, height)
W.set_maximum_size (...) -> None
  set_minimum_size(self, width, height)
W.set_minimum_size (...) -> None
  set_opacity(self, opacity)
W.set_opacity (...) -> None
  set_position(self, x, y)
W.set_position (...) -> None
  set_size(self, width, height)
W.set_size (...) -> None
  set_state(self, state)
W.set_state (...) -> None
  set_style(self, style)
W.set_style (...) -> None
  set_tooltip(self, tooltip)
W.set_tooltip (...) -> None
  unlock(self)
W.unlock () -> None
  _get_rect(self)
W._get_rect () -> pygame.Rect
  _get_rect_attr(self, attr)
W._get_rect_attr (...) -> var
  _set_rect_attr(self, attr, value)
W._set_rect_attr (...) -> None
    Inherited from BaseObject
  connect_signal(self, signal, callback, *data)
B.connect_signal (...) -> EventCallback
  disconnect_signal(self, event)
B.disconnect_signal (...) -> None
  emit(self, signal, data)
B.emit (...) -> bool
  run_signal_handlers(self, signal, *data)
B.run_signal_handlers (...) -> None
    Inherited from Sprite
  __repr__(self)
  add(self, *groups)
add(group or list of of groups, ...) add a sprite to container
  add_internal(self, group)
  alive(self)
alive() -> bool check to see if the sprite is in any groups
  groups(self)
groups() -> list of groups list used sprite containers
  kill(self)
kill() remove this sprite from all groups
  remove(self, *groups)
remove(group or list of groups, ...) remove a sprite from container
  remove_internal(self, group)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Property Summary
  children: List of the children for the Container.
  padding: The additional padding for the Container.
  spacing: The spacing between the children.
    Inherited from BaseWidget
  bottom
  bottomleft
  bottomright
  center
  centerx
  centery
  controls: Widgets associated with the widget.
  depth: The z-axis layer depth of the widget.
  dirty: Indicates, whether the widget need to be redrawn.
  entered: Indicates, whether the widget is entered.
  eventarea: The area, which gets the events.
  focus: The focus of the widget.
  h
  height
  image: The visible surface of the widget.
  index: The tab index position of the widget.
  indexable: The IIndexable, the widget is attached to.
  left
  locked: Indicates, whether the widget is locked.
  maxsize: The maximum size to occupy by the widget.
  midbottom
  midleft
  midright
  midtop
  minsize: The guaranteed size of the widget.
  opacity: The opacity of the widget.
  position: The position of the topleft corner.
  rect: The area occupied by the widget.
  right
  sensitive: The sensitivity of the widget.
  size
  state: The current state of the widget.
  style: The style of the widget.
  tooltip: The tool tip text to display for the widget.
  top
  topleft
  topright
  w
  width
  x
  y
    Inherited from BaseObject
  manager: The event manager to use by the object.

Instance Method Details

add_child(self, *children)

C.add_child (...) -> None

Adds one or more children to the Container.

Adds one or more children to the Container and updates the parent-child relationships.

Raises a TypeError, if one of the passed arguments does not inherit from the BaseWidget class. Raises an Exception, if one of the passed arguments is already attached to another parent.

calculate_size(self)

C.calculate_size (...) -> int, int

Calculates the size needed by the children.

Calculates the size needed by the children and returns the resulting width and height.

This method has to be implemented by inherited widgets.

destroy(self)

C.destroy () -> None

Destroys the Container and removes it from its event system.
Overrides:
ocempgui.widgets.BaseWidget.BaseWidget.destroy

dispose_widgets(self)

C.dispose_widgets (...) -> None

Sets the children to their correct positions within the Container.

This method has to be implemented by inherited widgets.

insert_child(self, pos, *children)

C.insert_child (...) -> None

Inserts one or more children at the desired position.

Inserts one or more children at the desired position to the Container and updates the parent-child relationships.

Raises a TypeError, if one of the passed arguments does not inherit from the BaseWidget class. Raises an Exception, if one of the passed arguments is already attached to another parent.

remove_child(self, child)

C.remove_child (...) -> None

Removes a child from the Container.

Removes the child from the Container and updates the parent-child relationship of the child.

Raises a TypeError, if the passed argument does not inherit from the BaseWidget class.

set_children(self, children)

C.set_children (...) -> None

Sets the children of the Container.

Sets the children of the Container to the passed list of widgets. If the Container already contains children, they will be removed first.

Raises a TypeError, if one of the passed arguments does not inherit from the BaseWidget class. Raises an Exception, if one of the passed arguments is already attached to another parent.

set_depth(self, depth)

C.set_depth (...) -> None

Sets the depth of the Container.

Sets the depth of the Container and its children to the given value.
Overrides:
ocempgui.widgets.BaseWidget.BaseWidget.set_depth

set_event_manager(self, manager)

C.set_event_manager (...) -> None

Sets the event manager of the Container.

Adds the Container to an event manager and causes its children to be added to the same, too.
Overrides:
ocempgui.widgets.BaseWidget.BaseWidget.set_event_manager

set_indexable(self, indexable)

C.set_indexable (...) -> None

Sets the indexable of the Container.

Adds the Container to an IIndexable implementation and causes its children to be added to the same, too.
Overrides:
ocempgui.widgets.BaseWidget.BaseWidget.set_indexable

set_padding(self, padding)

C.set_padding (...) -> None

Sets the padding between the edges and children of the Container.

The padding value is the amount of pixels to place between the edges of the Container and its child widgets.

Raises a TypeError, if the passed argument is not a positive integer.

set_sensitive(self, sensitive=True)

C.set_sensitive (...) -> None

Sets the sensitivity of the Container and its children.
Overrides:
ocempgui.widgets.BaseWidget.BaseWidget.set_sensitive

set_spacing(self, spacing)

C.set_spacing (...) -> None

Sets the spacing between the children of the Container.

The spacing value is the amount of pixels to place between the children of the Container.

Raises a TypeError, if the passed argument is not a positive integer.

update(self, **kwargs)

C.update (...) -> None

Updates the Container and refreshes its image and rect content.

Updates the Container and causes its parent to update itself on demand.
Overrides:
ocempgui.widgets.BaseWidget.BaseWidget.update

_add(self, **kwargs)

C._add (...) -> None

Internal add method for child additions to the container.

Property Details

children

List of the children for the Container.
Get Method:
unknown-696642332(...)
Set Method:
unknown-696642388(...)

padding

The additional padding for the Container.
Get Method:
unknown-696642220(...)
Set Method:
unknown-696642276(...)

spacing

The spacing between the children.
Get Method:
unknown-696642108(...)
Set Method:
unknown-696642164(...)

Generated by Epydoc 2.1 on Thu Jan 10 10:18:42 2008 http://epydoc.sf.net