traitsui.table_column module

Defines the table column descriptor used by the editor and editor factory classes for numeric and table editors.

class traitsui.table_column.ExpressionColumn[source]

Bases: ObjectColumn

A column for displaying computed values.

editable = Constant(False)

Is this column editable?

expression = Expression

The Python expression used to return the value of the column:

get_raw_value(object)[source]

Gets the unformatted value of the column for a specified object.

globals = Dict()

The globals dictionary that should be passed to the expression evaluation:

class traitsui.table_column.ListColumn[source]

Bases: TableColumn

A column for editing lists.

get_editor(object)[source]

Gets the editor for the column of a specified object.

get_value(object)[source]

Gets the value of the column for a specified object.

index = Int()

Index of the list element associated with this column

key(object)[source]

Returns the value to use for sorting.

set_value(object, value)[source]

Sets the value of the column for a specified object.

class traitsui.table_column.NumericColumn[source]

Bases: ObjectColumn

A column for editing Numeric arrays.

format = Str("%s")

Formatting string for the cell value

get_cell_color(object)[source]

Returns the cell background color for the column for a specified object row.

get_data_column(object)[source]

Gets the entire contents of the specified object column.

get_editor(object)[source]

Gets the editor for the column of a specified object row.

get_horizontal_alignment(object)[source]

Returns the horizontal alignment for the column for a specified object row.

get_menu(object, row)[source]

Returns the context menu to display when the user right-clicks on the column for a specified object row.

get_text_color(object)[source]

Returns the text color for the column for a specified object row.

get_text_font(object)[source]

Returns the text font for the column for a specified object row.

get_type(object)[source]

Gets the type of data for the column for a specified object row.

get_value(object)[source]

Gets the value of the column for a specified object row.

get_vertical_alignment(object)[source]

Returns the vertical alignment for the column for a specified object row.

horizontal_alignment = "center"

Horizontal alignment of text in the column; this value overrides the default.

is_droppable(object, row, value)[source]

Returns whether a specified value is valid for dropping on the column for a specified object row.

is_editable(object)[source]

Returns whether the column is editable for a specified object row.

label = Property()

Column label to use for this column

selected_cell_color = Color(0xD8FFD8)

Cell background color for this column when selected

selected_text_color = Color("black")

Text color this column when selected

selected_text_font = Font

Text font for this column when selected

set_value(object, row, value)[source]

Sets the value of the column for a specified object row.

class traitsui.table_column.ObjectColumn[source]

Bases: TableColumn

A column for editing objects.

editor = Instance(EditorFactory)

Trait editor used to edit the contents of this column:

format = Str("%s")

Format string to apply to column values:

format_func = Callable()

Format function to apply to column values:

get_drag_value(object)[source]

Returns the drag value for the column.

get_editor(object)[source]

Gets the editor for the column of a specified object.

get_raw_value(object)[source]

Gets the unformatted value of the column for a specified object.

get_style(object)[source]

Gets the editor style for the column of a specified object.

get_value(object)[source]

Gets the formatted value of the column for a specified object.

is_droppable(object, value)[source]

Returns whether a specified value is valid for dropping on the column for a specified object.

key(object)[source]

Returns the value to use for sorting.

label = Property()

Column label to use for this column:

name = Str()

Name of the object trait associated with this column:

set_value(object, value)[source]

Sets the value of the column for a specified object.

style = EditorStyle

The editor style to use to edit the contents of this column:

target_name(object)[source]

Returns the target object and name for the column.

class traitsui.table_column.TableColumn[source]

Bases: HasPrivateTraits

Represents a column in a table editor.

auto_editable = Bool(False)

Is the column automatically edited/viewed (i.e. should the column editor or popup be activated automatically on mouse over)?

cell_color = Color("white", allow_none=True)

Cell background color for this column:

cmp(object1, object2)[source]

Returns the result of comparing the column of two different objects.

This is deprecated.

droppable = Bool(False)

Can external objects be dropped on the column?

edit_height = Float(-1.0)

The height of the column cell’s row while it is being edited (< 0.0: Default, 0.0..1.0: fraction of total table height, > 1.0: absolute height in pixels):

edit_width = Float(-1.0)

The width of the column while it is being edited (< 0.0: Default, 0.0..1.0: fraction of total table width, > 1.0: absolute width in pixels):

editable = Bool(True)

Is this column editable?

get_cell_color(object)[source]

Returns the cell background color for the column for a specified object.

get_edit_height(object)[source]

Returns the height of the column cell’s row while it is being edited.

get_edit_width(object)[source]

Returns the edit width of the column.

get_graph_color(object)[source]

Returns the cell background graph color for the column for a specified object.

get_horizontal_alignment(object)[source]

Returns the horizontal alignment for the column for a specified object.

get_image(object)[source]

Returns the image to display for the column for a specified object.

get_label()[source]

Gets the label of the column.

get_maximum(object)[source]

Returns the maximum value a numeric column can have.

get_menu(object)[source]

Returns the context menu to display when the user right-clicks on the column for a specified object.

get_object(object)[source]

Returns the actual object being edited.

get_renderer(object)[source]

Returns the renderer for the column of a specified object.

get_text_color(object)[source]

Returns the text color for the column for a specified object.

get_text_font(object)[source]

Returns the text font for the column for a specified object.

get_tooltip(object)[source]

Returns the tooltip to display when the user mouses over the column for a specified object.

get_type(object)[source]

Gets the type of data for the column for a specified object.

get_vertical_alignment(object)[source]

Returns the vertical alignment for the column for a specified object.

get_view(object)[source]

Returns the view to display when clicking a non-editable cell.

get_width()[source]

Returns the width of the column.

graph_color = Color(0xDDD9CC)

Cell graph color:

horizontal_alignment = Enum("left", ["left", "center", "right"])

Horizontal alignment of text in the column:

horizontal_margin = Int(4)

Horizontal cell margin

image = Image

The image to display in the cell:

is_auto_editable(object)[source]

Returns whether the column is automatically edited/viewed for a specified object.

is_droppable(object, value)[source]

Returns whether a specified value is valid for dropping on the column for a specified object.

is_editable(object)[source]

Returns whether the column is editable for a specified object.

label = Str(UndefinedLabel)

Column label to use for this column:

maximum = Float(trait_value=True)

Optional maximum value a numeric cell value can have:

menu = Instance(Menu)

Context menu to display when this column is right-clicked:

on_click(object)[source]

Called when the user clicks on the column.

on_dclick(object)[source]

Called when the user clicks on the column.

read_only_cell_color = Color(0xF4F3EE, allow_none=True)

Cell background color for non-editable columns:

renderer = Any  # A toolkit specific renderer

Renderer used to render the contents of this column:

resize_mode = Enum("interactive", "fixed", "stretch", "resize_to_contents")

The resize mode for this column. This takes precedence over other settings (like width, above). - “interactive”: column can be resized by users or programmatically - “fixed”: users cannot resize the column, but it can be set programmatically - “stretch”: the column will be resized to fill the available space - “resize_to_contents”: column will be sized to fit the contents, but then cannot be resized

show_checkbox = Bool(True)

Should a checkbox be displayed instead of True/False?

text_color = Color("black")

Text color for this column:

text_font = Union(None, Font)

Text font for this column:

tooltip = Str()

The tooltip to display when the mouse is over the column:

vertical_alignment = Enum("center", ["top", "center", "bottom"])

Vertical alignment of text in the column:

vertical_margin = Int(3)

Vertical cell margin

view = AView

The view (if any) to display when clicking a non-editable cell:

visible = Bool(True)

Is the table column visible (i.e., viewable)?

width = Float(-1.0)

The width of the column (< 0.0: Default, 0.0..1.0: fraction of total table width, > 1.0: absolute width in pixels):