Advertisement
here2share

# Tk_numbered_list_of_checkboxes.py

May 28th, 2018
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. # Tk_numbered_list_of_checkboxes.py
  2.  
  3. from Tkinter import *
  4.  
  5. def demo():
  6.     vsb = Scrollbar(orient="vertical")
  7.     text = Text(width=40, height=20, yscrollcommand=vsb.set)
  8.     vsb.config(command=text.yview)
  9.     vsb.pack(side="right", fill="y")
  10.     text.pack(side="left", fill="both", expand=True)
  11.  
  12.     for i in range(100):
  13.         cb = Checkbutton(text="checkbutton #%s" % i)
  14.         text.window_create("end", window=cb)
  15.         text.insert("end", "\n") # to force one checkbox per line
  16.  
  17. root = Tk()
  18. demo()
  19. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement