[Tutor] tkinter help 2
Walter Hanagriff
princeshinji@xoommail.com
Sun, 26 Mar 2000 22:18:10 -0800
greetings to all:
in my program i want the next button to go to a certain
frame depending on the value of a
radiobutton, here is the code:
class Frames:
# this function makes the first frame for the program
def __init__(self, master):
frame = Frame(root, width = 285, height = 400)
frame.pack()
Label(frame, text = "this program figures the area,
perimeter, and power of n \n"
"____________________________________________").pack()
v = IntVar()
Radiobutton(frame, text = "1 = Find the power of a
number", variable = v, value = 1).pack(anchor = W)
Radiobutton(frame, text = "2 = Find the area of a
shape", variable = v, value = 2).pack(anchor = W)
Radiobutton(frame, text = "3 = Find the perimeter of
a shape", variable = v, value = 3).pack(anchor = W)
next = Button(frame, text = "Next", padx = 10,
command = ifpick(v))
next.pack(side = LEFT, padx = 5)
close = Button(frame, text = "Close", padx = 10,
command = root.quit)
close.pack(side = LEFT, padx = 5)
# this says which frame to open depending on which
radiobutton above is picked by user
def ifpick(self, v):
if v == 1: frame2()
elif v == 2: frame3()
elif v == 3: frame4()
i cant seem to get the value of v in ifpick though, i try
many things and get different errors everytime, how do i get
the value? and is anything wrong with this code so far? i
just started learning tkinter a few weeks ago and still
learning the basics
______________________________________________________
Get your free web-based email at http://www.xoom.com
Birthday? Anniversary? Send FREE animated greeting
cards for any occasion at http://greetings.xoom.com