Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # tk_checkboxes.py
- import tkinter as tk
- root = tk.Tk()
- root.title("Checkbox Example")
- sss = '1 2* 3* 4 5'.split()
- def create_checkboxes(items):
- for item in items:
- var = tk.BooleanVar()
- if '*' in item:
- var.set(1)
- item = item[0]
- cb = tk.Checkbutton(root, text=item, variable=var)
- cb.pack(anchor='w')
- variables.append(var)
- variables = []
- create_checkboxes(sss)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement