Skip to content

hkb_editor.gui.widgets.editable_table

add_filepaths_table

Bases: DpgItem

A file/folder path list widget built on add_widget_table.

Provides an add-files (or add-folders) button that opens a native dialog. Each path is shown as a read-only shortened text field.

Parameters:

Name Type Description Default
initial_paths list of Path

Paths to pre-populate the table with.

required
on_value_changed callable

Fired as on_value_changed(tag, all_paths, user_data) after any add or remove.

None
folders bool

Use folder-picker dialog instead of file-picker.

False
label str

Text label rendered above the table.

'Files'
filetypes dict

Passed to open_multiple_dialog when folders is False.

None
on_select callable

Fired as on_select(tag, path, user_data) when a row is clicked.

None
show_clear bool

Show a clear-all button.

False
parent int or str

DPG parent item.

0
tag int or str

Explicit tag; auto-generated if 0.

0
user_data any

Passed through to callbacks.

None

add_widget_table

Bases: DpgItem

A generic editable table widget for Dear PyGui.

Renders a list of items as table rows via a caller-supplied create_row function. Optionally supports adding, removing, selecting, and clearing items. If new_item is not set, add/remove controls are hidden.

Row selection is implemented with a narrow dedicated button column rather than a span_columns selectable, so the remove button remains clickable.

Parameters:

Name Type Description Default
initial_values list

Items to populate the table with on construction.

required
create_row callable

Called as create_row(value, index) to build each row's DPG items.

required
new_item callable

Called as new_item(done_callback) when the add button is clicked. done_callback accepts the new item to append.

None
on_add callable

Fired as on_add(tag, (index, item, all_items), user_data).

None
on_remove callable

Fired as on_remove(tag, (index, item, all_items), user_data).

None
on_select callable

Fired as on_select(tag, (index, item, all_items), user_data).

None
header_row bool

Show column headers.

False
columns list of str

Column header labels.

('Value',)
label str

Text label rendered above the table.

None
add_item_label str

Label for the add button.

'+'
show_clear bool

Show a clear-all button next to the add button.

False
parent int or str

DPG parent item.

0
tag int or str

Explicit tag; auto-generated if 0 or None.

0
user_data any

Passed through to all callbacks.

None

items property writable

items: list[_T]

Current item list (read-only copy).

append

append(item: _T, *, fire_callbacks: bool = False) -> None

Append an item and refresh the table.

clear

clear(*, fire_callbacks: bool = False) -> None

Remove all items and refresh the table.

remove

remove(idx: int, *, fire_callbacks: bool = False) -> None

Remove the item at idx and refresh the table.

Ko-fi donations