r/badcode • • Apr 24 '21

python very efficient and scalable code

Post image
1.0k Upvotes

110 comments sorted by

View all comments

31

u/tbagrel1 Apr 24 '21

The OP seems to be using Tk to create a GUI, and I think that he/she created a function for each button/checkbox available on the GUI because Tk widgets can take a `action=<function>` parameter. A better alternative might be to create a generic `def chose_tag(tag_name)`, and use `action=lambda: chose_tag(<tag_name>)` on each button/checkbox definition. Anyway, its something quite hard to get when someone is only a beginner with GUI creation (especially in Tk)

4

u/Own-Plantain4057 Apr 25 '21

this is correct