Type aliasing#

TkClassWizard allows types to be aliased. Alias is an alternative name or nickname for a specific type.

Type aliasing can be done within the tkclasswiz.aliasing.register_alias() function. An alias can be obtained through tkclasswiz.aliasing.get_aliased_name() function.

For example, we can give the timedelta type an alternative name:

from datetime import timedelta
import tkclasswiz as wiz

wiz.register_alias(timedelta, "Duration")

If we define a type alias like in the above example, then the timedelta class will look like shown in the following 2 images:

../_images/type_alias_one_frame_param.png

Fig. 1 timedelta type alias display after definition of parameters.#


../_images/new_define_frame_struct_alias_new_timedelta.png

Fig. 2 timedelta type alias display inside the New object menu.#