Object frames#
NewObjectFrameBase#
- class tkclasswiz.object_frame.frame_base.NewObjectFrameBase(class_: Any, return_widget: ComboBoxObjects | ListBoxObjects | None, parent=None, old_data: Any | None = None, check_parameters: bool = True, allow_save=True)#
Base Frame for inside the
ObjectEditWindowthat allows object definition.- Parameters:
class (Any) – The class we are defining for.
return_widget (Any) – The widget to insert the ObjectInfo into after saving.
parent (TopLevel) – The parent window.
old_data (Any) – The old_data gui data.
check_parameters (bool) – Check parameters (by creating the real object) upon saving. This is ignored if editing a function instead of a class.
allow_save (bool) – If False, will open in read-only mode.
- class_#
The type (class) of object being creating
- return_widget#
The widget where the abstract object (ObjectInfo) will be stored
- check_parameters#
Check for parameters on save
- allow_save#
Saving is allowed
- old_gui_data#
If editing, the value being edited
- editing_index#
The index of object being edited
- static get_cls_name(cls: Any, args: bool = False) str#
Returns the name of the class
clsor the original class when the name cannot be obtained. If alias exists, alias is returned instead.
- classmethod check_literals(value: str, literal_types: Iterable)#
Checks if the
valueis a correct iterable.- Parameters:
value (str) – The string value to be checked.
types (Iterable[Literal]) – An iterable of accepted literals.
- classmethod cast_type(value: Any, types: Iterable)#
Tries to convert value into one of the types inside types (first successful).
- Raises:
TypeError – Could not convert into any type.
- update_window_title()#
Set’s the window title according to edit context.
- new_object_frame(class_, widget, *args, **kwargs)#
Opens up a new object frame on top of the current one. Parameters are the same as in
NewObjectFrame(current class).
- abstract to_object()#
Creates an object from the GUI data.
- abstract load(old_data: Any)#
Loads the old object info data into the GUI.
- Parameters:
old_data (Any) – The old gui data to load.
- save()#
Save the current object into the return widget and then close this frame.
- remember_gui_data()#
Remembers GUI data for change checking.
NewObjectFrameIterable#
- class tkclasswiz.object_frame.frame_iterable.NewObjectFrameIterable(*args, **kwargs)#
Frame for use inside the ObjectEditWindow that allows definition of lists / iterables. The list annotations should be annotated similarly to the following example:
list[Union[int, float]]orIterable[Union[int, float]]orIterable[SomeClass]- Parameters:
class (Any) – The class we are defining for.
return_widget (Any) – The widget to insert the ObjectInfo into after saving.
parent (TopLevel) – The parent window.
old_data (Any) – The old_data gui data.
check_parameters (bool) – Check parameters (by creating the real object) upon saving. This is ignored if editing a function instead of a class.
allow_save (bool) – If False, will open in read-only mode.
- load(old_data: List[Any])#
Loads the old object info data into the GUI.
- Parameters:
old_data (Any) – The old gui data to load.
- to_object()#
Creates an object from the GUI data.
NewObjectFrameString#
- class tkclasswiz.object_frame.frame_string.NewObjectFrameString(class_: Any, return_widget: Any, parent=None, old_data: str | None = None, check_parameters: bool = True, allow_save=True)#
- load(old_data: Any)#
Loads the old object info data into the GUI.
- Parameters:
old_data (Any) – The old gui data to load.
- to_object()#
Creates an object from the GUI data.
NewObjectFrameStruct#
- class tkclasswiz.object_frame.frame_struct.NewObjectFrameStruct(*args, **kwargs)#
Frame for inside the
ObjectEditWindowthat allows object definition.- Parameters:
class (Any) – The class we are defining for.
return_widget (ComboBoxObjects | ListBoxScrolled) – The widget to insert the ObjectInfo into after saving.
parent (TopLevel) – The parent window.
old_data (ObjectInfo) – The old_data ObjectInfo object to edit.
check_parameters (bool) – Check parameters (by creating the real object) upon saving. This is ignored if editing a function instead of a class.
allow_save (bool) – If False, will open in read-only mode.
additional_values (Dict[str, Any]) – A mapping of additional values to be inserted into corresponding field.
- load(old_data: ObjectInfo)#
Loads the old object info data into the GUI.
- Parameters:
old_data (Any) – The old gui data to load.
- to_object(*, ignore_checks=False) ObjectInfo#
Converts GUI data into an ObjectInfo abstraction object.
- Parameters:
ignore_checks (bool) – Don’t check the correctness of given parameters.
NewObjectFrameFlag#
- class tkclasswiz.object_frame.frame_flag.NewObjectFrameFlag(class_: Flag, return_widget: T, parent: Toplevel | None = None, old_data: Flag | None = None, check_parameters: bool = True, allow_save=True)#
Frame for use inside the ObjectEditWindow that allows definition of enum flags.
- Parameters:
class (Flag) – The class we are defining for.
return_widget (T) – The widget to insert the ObjectInfo into after saving.
parent (TopLevel) – The parent window.
old_data (Flag) – The old_data gui data.
check_parameters (bool) – Check parameters (by creating the real object) upon saving. This is ignored if editing a function instead of a class.
allow_save (bool) – If False, will open in read-only mode.
- load(old_data: Flag)#
Loads the old object info data into the GUI.
- Parameters:
old_data (Any) – The old gui data to load.
- get_gui_data()#
Returns all GUI values.