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

Style id generator #393

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aDramaQueen
Copy link

Hi,

this is a pure convenience proposal. You may think this is useless but since I am always mistyping things, I use such approaches all the time and maybe others think this as well. So here we are...

I enumerated all possible bootstrap styles and wrote some utility classes to generate specific style identifiers.

Simply put, instead of remembering all possible string combinations from the documentation, you may now choose from staticly well defined constants & generate your identifier of choice:

from ttkbootstrap.style_bootstrap import BootstrapStyle, Button, Combobox, Progressbar

if __name__ == '__main__':
    button_id = Button.outline_button(BootstrapStyle.INFO)
    combobox_id = Combobox.default(BootstrapStyle.DANGER)
    progressbar_id = Progressbar.striped(BootstrapStyle.SUCCESS)

    print(button_id)
    print(combobox_id)
    print(progressbar_id)

Result:

info-outline
danger
success-striped

Additionally, if you work with an IDE from this century you get the static choices presented:

grafik

@israel-dryer
Copy link
Owner

Hi, agree that this is needed. It is actually something I'm working on adding in 2.0 as well as a healthy dose of type hinting where it's possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants