traitsui.editors.tabular_editor module

A traits UI editor for editing tabular data (arrays, list of tuples, lists of objects, etc).

class traitsui.editors.tabular_editor.TabularEditor(*args, **traits)[source]

Bases: BasicEditorFactory

Editor factory for tabular editors.

activated = Str()

The optional extended name of the trait to synchronize the activated value with:

activated_row = Str()

The optional extended name of the trait to synchronize the activated value’s row with:

adapter = Instance("traitsui.tabular_adapter.TabularAdapter", ())

The adapter from trait values to editor values:

auto_resize = Bool(False)

Should the columns automatically resize? Don’t allow this when the amount of data is large.

auto_resize_rows = Bool(False)

Should the rows automatically resize (Qt4 only)? Don’t allow this when the amount of data is large.

auto_update = Bool(False)

Should the table update automatically when the table item’s contents change? Note that in order for this feature to work correctly, the editor trait should be a list of objects derived from HasTraits. Also, performance can be affected when very long lists are used, since enabling this feature adds and removed Traits listeners to each item in the list.

clicked = Str()

The optional extended name of the trait to synchronize left click data with. The data is a TabularEditorEvent:

column_clicked = Str()

The optional extended name of the trait to synchronize column clicked data with. The data is a TabularEditorEvent:

column_right_clicked = Str()

The optional extended name of the trait to synchronize column right clicked data with. The data is a TabularEditorEvent:

dclicked = Str()

The optional extended name of the trait to synchronize left double click data with. The data is a TabularEditorEvent:

drag_move = Bool(True)

Are ‘drag_move’ operations allowed (i.e. True), or should they always be treated as ‘drag_copy’ operations (i.e. False):

editable = Bool(True)

Can the user edit the values?

editable_labels = Bool(False)

Can the user edit the labels (i.e. the first column)

horizontal_lines = Bool(True)

Should horizontal lines be drawn between items?

images = List(Image)

The set of images that can be used:

klass = Property()

The editor class to be created:

multi_select = Bool(False)

Are multiple selected items allowed?

operations = List(

What type of operations are allowed on the list:

refresh = Str()

The optional extended name of the trait used to indicate that the table just needs to be repainted.

right_clicked = Str()

The optional extended name of the trait to synchronize right click data with. The data is a TabularEditorEvent:

right_dclicked = Str()

The optional extended name of the trait to synchronize right double clicked data with. The data is a TabularEditorEvent:

scroll_to_column = Str()

The optional extended name of the Event trait that should be used to trigger a scroll-to command. The data is an integer giving the column.

scroll_to_position_hint = Enum("visible", "center", "top", "bottom")

(replacement of scroll_to_row_hint, but more clearly named) Controls behavior of scroll to row and scroll to column

scroll_to_row = Str()

The optional extended name of the Event trait that should be used to trigger a scroll-to command. The data is an integer giving the row.

scroll_to_row_hint = Property(Str, observe="scroll_to_position_hint")

Deprecated: Controls behavior of scroll to row and scroll to column

selectable = Bool(True)

Whether or not to allow selection.

selected = Str()

The optional extended name of the trait to synchronize the selection values with:

selected_row = Str()

The optional extended name of the trait to synchronize the selection rows with:

show_row_titles = Bool(False)

Should row headers be displayed (Qt4 only)?

show_titles = Bool(True)

Should column headers (i.e. titles) be displayed?

stretch_last_section = Bool(True)

Whether to stretch the last column to fit the available space.

update = Str()

The optional extended name of the trait used to indicate that a complete table update is needed:

vertical_lines = Bool(True)

Should vertical lines be drawn between items?