Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validation module for easy to apply validation rules #113

Closed
israel-dryer opened this issue Jan 3, 2022 · 1 comment · Fixed by #129
Closed

Add validation module for easy to apply validation rules #113

israel-dryer opened this issue Jan 3, 2022 · 1 comment · Fixed by #129
Labels
enhancement New feature or request

Comments

@israel-dryer
Copy link
Owner

Add a module that includes several functions that will add pre-defined validation to entry type widgets. These methods will accept the widget object as an argument and will make the validation api of the tkinter widgets much easier to apply.

A mask could be applied through some pattern... regex, or something else.

When the widget is in an invalid state, the border is set to the 'danger' color.

Some possible examples:

def validate_text(obj, when='focusout', func=None, mask=None):
    ...

def validate_number(obj, when='focusout', func=None):
    ...

def validate_phone_number(obj, when='focusout', func=None, mask="(000)000-000"):
    ...

def validate_date(obj, when='focusout', func=None, mask="%Y-%m-%d"):
    ...

entry = ttk.Entry()
validate_phone_number(entry, func=None)
@israel-dryer israel-dryer added the enhancement New feature or request label Jan 3, 2022
@israel-dryer
Copy link
Owner Author

Consider applying this to Tableview per #114 (comment)

@israel-dryer israel-dryer linked a pull request Jan 10, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant