Storage widgets#

HintedEntry#

class tkclasswiz.storage.HintedEntry(hint: str, *args, **kwargs)#

A hinted tkinter.ttk.Entry. The entry accepts the parameter hint (The hinting text which will be displayed in gray) and the original tkinter.ttk.Entry parameters.

get() str#

Return the text.

insert(*args, **kwargs) None#

Insert STRING at INDEX.

PyObjectScalar#

class tkclasswiz.storage.PyObjectScalar(*args, **kwargs)#

Represents a single storage widget for a Python object.

get() object#

Returns the stored Python object (or None if not set).

set(value: object)#

Sets the Python object as the widget’s value.

Text#

class tkclasswiz.storage.Text(master=None, cnf={}, **kw)#

Modified version of :class`tkinter.Text`, which replaces the original get method to contain no parameters and instead return the entire text stripped. This is for compatibility with other storage widgets.

get() str#

Returns entire text stripped.

ListBoxObjects#

class tkclasswiz.storage.ListBoxObjects(*args, **kwargs)#

Modified version of tkinter.Listbox, which:

  • Allows copy-paste and also sets the standard keyboard shortcuts for it

  • Implements the current method for compatibility with tkclasswiz.storage.ComboBoxObjects

  • Overwrites the get method to return the original objects instead of text

  • Modifies the insert method to insert original objects instead of text

current() int#

Returns index of the first currently selected element or -1 if none selected.

get(first: int = 0, last: int | None = None) list#

Returns elements from first to last (not included).

insert(index: str | int, *elements: str | float) None#

Inserts elements to index. The index must be a numerical index or tkinter.END (‘end’).

delete(*indexes: int) None#

Delete elements that have the index in indexes

count() int#

Returns the amount of elements inside the internal list.

delete_selected()#

Deletes selected elements.

clear() None#

Deletes all the elements inside the internal list.

save_to_clipboard()#

Saves selection to clipboard.

paste_from_clipboard()#

Paste elements from clipboard.

move(index: int, direction: int)#

Move a element inside the list box around.

Parameters:
  • index (int) – Index of the element to move.

  • direction (int) – To move forward pass 1, to move backwards pass -1.

move_selection(direction: int)#

Moves the selected element up inside the list box. Pass direction value 1 if you want to move forward, or -1 for backwards.

ListBoxScrolled#

class tkclasswiz.storage.ListBoxScrolled(parent, *args, **kwargs)#

A scrollable version of tkclasswiz.storage.ListBoxObjects. All the methods are the same as tkclasswiz.storage.ListBoxObjects.

ComboBoxObjects#

class tkclasswiz.storage.ComboBoxObjects(*args, **kwargs)#

Modified version of tkinter.Combobox, which:

  • Allows copy-paste and also sets the standard keyboard shortcuts for it

  • Overwrites the get method to return the original objects instead of text

  • Modifies the insert method to insert original objects instead of text

save_to_clipboard()#

Saves selected element to Clipboard.

paste_from_clipboard()#

Paste element(s) from clipboard.

get() Any#

Returns selected element

delete(index: int) None#

Removes the element at index.

insert(index: int | str, element: Any) None#

Insert the element to the spot at index.

count() int#

Returns number of elements inside the ComboBox

ComboEditFrame#

class tkclasswiz.storage.ComboEditFrame(edit_method: Callable, values: List[Any] = [], master=None, *args, **kwargs)#

Frame, which combines tkclasswiz.storage.ComboBoxObjects and an edit button. The edit button will open an object edit window / wizard and load in the old object (ObjectInfo) data.

Parameters:
set_values(values: List[Any] = [])#

Sets the combobox values to values.