Skip to content

Modules

LinuxEducation edited this page Dec 29, 2023 · 11 revisions

Note

Modules are ready-made, independent components that provide functionality. tesTk supports custom modules based on tesTk widgets, modules based solely on the Tkinter library or ready-to-use functions.


tesSimpleSettingMenu

This module is a simple and easy-to-use application menu.

🚩 module options

Parameter Type Default Description
title str 'Setting Menu' title of window settings.
window_x / window_y int 500x300 standard, basic window size.
setting_data dict tip implemented expects object type dictionary.
setting_file str 'default_setting_menu.json' the name of the file in which the settings will be remembered.
setting_save bool True writing will be enabled/disabled.
command func None expects function, method.

🔵 module methods

.get_settings() | This method allows you to get settings from the module (menu).

example

import ...

data = {'shadow':    [True, 'Draw shadow'],
        'border':    [None, 'Draw border'],
        'animation': [0, 'Enabled widget animation']}

def your_function() -> None:
    menu = tesSimpleSettingMenu(setting_data=data)
    settings = menu.get_settings()

app = App()
tesButton(app, command=your_function).pack()
app.mainloop()

example

import ...

data = {'shadow':    [True, 'Draw shadow'],
        'border':    [None, 'Draw border'],
        'animation': [0, 'Enabled widget animation']}

def do_something(settings_file: str) -> None:
    ''' you need to import module setting_data '''
    settings = read_user_settings(settings_file)
    if 'shadow' in settings:
        # Execute the program
        ...

def your_function() -> None:
    tesSimpleSettingMenu(setting_data=data,
                         setting_file='your_settings.json',
                         command=lambda: do_something('your_settings.json'))

app = App()
tesButton(app, command=your_function).pack()
app.mainloop()

tesAskQuestion

documentation, tips, available methods...

tesShowInfo

documentation, tips, available methods...

AppInformation

documentation, tips, available methods...


color_palette

This module returns all color information.

from func.color_palette import get_colors

🚩 function parameters

Parameter Type Default Description
style str None expects a style name: Material Color, Flat Color, Web Color.
names bool None expects True/False or None.

🔵 module functions

get_colors() | This function returns color style names, available color names or hexadecimal color codes.


setting_data

This module is responsible for writing and reading *json files.

from func.setting_data import write_user_settings, read_user_settings

🚩 function parameters

Parameter Type Default Description
settings_data dict None expects object type dictionary.
settings_file str None expects a file name for settings.

🔵 module functions

write_user_settings() | This function allows you to save settings to *json file.

read_user_settings() | This function allows you to read settings from a *json file.


icon_database

documentation, tips, available methods...

Clone this wiki locally