Deprecations#
TkClassWizard allows users to deprecate different classes, class’s parameters and types under a class’s parameter.
All the deprecations can be made with the tkclasswiz.deprecation.register_deprecated() function.
The function has 3 modes:
Deprecate class globally (only
clsparameter given)Deprecate a class’s parameter (
clsandparameterboth given)Deprecate a type under class’s parameter (
cls,parameterandtypesare all given). Please note thattypesis a variadic parameter, which means multiple types can be passed by just separating them with a comma.
from datetime import timedelta, datetime
import tkclasswiz as wiz
class Car:
def __init__(self, name: str, next_service: timedelta | datetime):
... # Implementation
wiz.register_deprecated(Car, "next_service", timedelta)
... # Other needed code
The above example will create the following definition window: