Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # addCheckBox.py
- import random
- import string
- from Tkinter import *
- root = Tk()
- class Cv(): 0
- cv = Cv()
- cv.t = 0
- cb = {}
- en = {}
- def addCheckBox():
- t = cv.t
- cb[t] = IntVar()
- en[t] = StringVar()
- label = Label(root, bg='aqua')
- label.grid(row=(t/6)+1, column=t%6)
- c = Checkbutton(label, bg='aqua', var=cb[t])
- c.grid(row=0, column=0)
- entry = Entry(label, textvariable=en[t])
- entry.grid(row=0, column=1)
- en[t].set('ABC %d'%(t+1))
- c.configure(width=0)
- entry.configure(width=25)
- cv.t +=1
- 0
- def getContent():
- t = cv.t
- for z in range(t):
- if cb[z].get():
- print en[z].get()
- 0
- b = Button(root, text="Add CheckBox", command=addCheckBox)
- b.grid(row=0,column=0)
- b.configure(width=25)
- b = Button(root, text="Get Content", command=getContent)
- b.grid(row=0,column=1)
- b.configure(width=25)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement