Answers for "variable checkbox py"

3

chech box in tkinter

from tkinter import *
master = Tk()
var1 = IntVar()
Checkbutton(master, text="male", variable=var1).grid(row=0, sticky=W)
var2 = IntVar()
Checkbutton(master, text="female", variable=var2).grid(row=1, sticky=W)
mainloop()
Posted by: Guest on May-05-2020
0

how to get checkbutton from a list

from Tkinter import *

root = Tk()    

users = ['Anne', 'Bea', 'Chris']

for x in range(len(users)):
    l = Checkbutton(root, text=users[x][0], variable=users[x])
    print "l = Checkbutton(root, text=" + str(users[x][0]) + ", variable=" + str(users[x])
    l.pack(anchor = 'w')

root.mainloop()
Posted by: Guest on October-15-2020

Python Answers by Framework

Browse Popular Code Answers by Language