| Home | Trees | Index | Help |
|---|
| Package ocempgui :: Package widgets :: Module Table :: Class Table |
|
object--+ |INotifyable--+ |BaseObject--+ |object--+ | | |Sprite--+ |BaseWidget--+ |Container--+ | Table
Table (rows, cols) -> Table A container widget, which packs its children in a table like manner. The Table class is a layout container, which packs it children in a regular, table like manner and allows each widget to be aligned within its table cell. The table uses a 0-based (Null-based) indexing, which means, that if 4 rows are created, they can be accessed using a row value ranging from 0 to 3. The same applies to the columns. The Table provides read-only 'columns' and 'rows' attributes, which are the amount of columns and rows within that Table. totalr = table.rows totalc = table.columns To access the children of the Table the 'grid' attribute can be used. It is a dictionary containing the widgets as values. To access a widget, a tuple containing the row and column is used as the dictionary key. widget = table.grid[(0, 3)] widget = table.grid[(7, 0)] The above examples will get the widget located at the first row, fourth column (0, 3) and the eighth row, first column (7, 0). The layout for each widget within the table can be set individually using the set_align() method. Alignments can be combined, which means, that a ALIGN_TOP | ALIGN_LEFT would align the widget at the topleft corner of its cell. However, not every alignment make sense, so a ALIGN_TOP | ALIGN_BOTTOM would cause the widget to be placed at the top. The priority order for the alignment follows. The lower the value, the higher the priority. Alignment Priority ----------------------- ALIGN_TOP 0 ALIGN_BOTTOM 1 ALIGN_LEFT 0 ALIGN_RIGHT 1 ALIGN_NONE 2 Default action (invoked by activate()): None Mnemonic action (invoked by activate_mnemonic()): None Attributes: columns - The column amount of the Table. rows - The row amount of the Table. grid - Grid to hold the children of the Table.
| Method Summary | |
|---|---|
__init__(self,
rows,
cols)
| |
T.add_child (...) -> None | |
T.calculate_size () -> int, int | |
T.destroy () -> None | |
T.dispose_widgets (...) -> None | |
T.draw () -> None | |
T.draw_bg () -> Surface | |
C.insert_child (...) -> None | |
T.remove_widget (...) -> None | |
T.set_align (...) -> None | |
T.set_children (...) -> None | |
T.set_column_align (...) -> None | |
T.set_focus (focus=True) -> None | |
T.set_row_align (...) -> None | |
| Inherited from Container | |
C.set_depth (...) -> None | |
C.set_event_manager (...) -> None | |
C.set_indexable (...) -> None | |
C.set_padding (...) -> None | |
C.set_sensitive (...) -> None | |
C.set_spacing (...) -> None | |
C.update (...) -> None | |
| Inherited from BaseWidget | |
W.activate () -> None | |
W.activate_mnemonic (...) -> bool | |
W.check_sizes (...) -> int, int | |
W.create_style () -> WidgetStyle | |
For debugging usage only | |
W.get_style () -> WidgetStyle | |
B.initclass () -> None (Class method) | |
W.lock () -> None | |
W.notify (...) -> None | |
W.rect_to_client (...) -> pygame.Rect | |
W.set_dirty (...) -> None | |
W.set_entered (...) -> None | |
W.set_event_area (...) -> None | |
W.set_index (...) -> None | |
W.set_maximum_size (...) -> None | |
W.set_minimum_size (...) -> None | |
W.set_opacity (...) -> None | |
W.set_position (...) -> None | |
W.set_size (...) -> None | |
W.set_state (...) -> None | |
W.set_style (...) -> None | |
W.set_tooltip (...) -> None | |
W.unlock () -> None | |
| Inherited from BaseObject | |
B.connect_signal (...) -> EventCallback | |
B.disconnect_signal (...) -> None | |
B.emit (...) -> bool | |
B.run_signal_handlers (...) -> None | |
| Inherited from Sprite | |
| |
add(group or list of of groups, ...) add a sprite to container | |
| |
alive() -> bool check to see if the sprite is in any groups | |
groups() -> list of groups list used sprite containers | |
kill() remove this sprite from all groups | |
remove(group or list of groups, ...) remove a sprite from container | |
| |
| Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
| Property Summary | |
|---|---|
columns: The column amount of the Table. | |
grid: The grid of the Table. | |
rows: The row amount of the Table. | |
| Inherited from Container | |
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, row, col, widget)T.add_child (...) -> None Adds a widget into the cell located at (row, col) of the Table. Raises a ValueError, if the passed row and col arguments are not within the cell range of the Table. Raises an Exception, if the cell at the passed row and col coordinates is already occupied. |
calculate_size(self)T.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. |
destroy(self)T.destroy () -> None Destroys the Table and all its children and shedules them for deletion by the renderer.
|
dispose_widgets(self)T.dispose_widgets (...) -> None Sets the children to their correct positions within the Table. |
draw(self)T.draw () -> None Draws the Table surface and places its children on it.
|
draw_bg(self)T.draw_bg () -> Surface Draws the background surface of the Table and returns it. Creates the visible surface of the Table and returns it to the caller. |
insert_child(self, pos, *children)C.insert_child (...) -> None Inserts one or more children at the desired position. Raises a NotImplementedError, as this method cannot be applied to the Table. |
remove_child(self, widget)T.remove_widget (...) -> None Removes a widget from the Table. |
set_align(self, row, col, align=0)T.set_align (...) -> None Sets the alignment for a specific cell. Raises a ValueError, if the passed row and col arguments are not within the rows and columns of the Table. Raises a TypeError, if the passed align argument is not a value from ALIGN_TYPES. |
set_children(self, children)T.set_children (...) -> None Sets the children of the Table. When setting the children of the Table, keep in mind, that the children will be added row for row, causing the Table to fill the first row of itself, then the second and so on. Raises a ValueError, if the passed amount of children exceeds the cell amount of the Table. |
set_column_align(self, col, align=0)T.set_column_align (...) -> None Sets the alignment for a whole column range. Raises a ValueError, if the passed col argument is not within the column range of the Table. Raises a TypeError, if the passed align argument is not a value from ALIGN_TYPES. |
set_focus(self, focus=True)T.set_focus (focus=True) -> None Overrides the set_focus() behaviour for the Table. The Table class is not focusable by default. It is a layout class for other widgets, so it does not need to get the input focus and thus it will return false without doing anything. |
set_row_align(self, row, align=0)T.set_row_align (...) -> None Sets the alignment for a whole row. Raises a ValueError, if the passed row argument is not within the row range of the Table. Raises a TypeError, if the passed align argument is not a value from ALIGN_TYPES. |
| Property Details |
|---|
columnsThe column amount of the Table.
|
gridThe grid of the Table.
|
rowsThe row amount of the Table.
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Thu Jan 10 10:18:42 2008 | http://epydoc.sf.net |