- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathradioButton.py
More file actions
Latest commit
20 lines (15 loc) · 685 Bytes
/
Copy pathradioButton.py
File metadata and controls
20 lines (15 loc) · 685 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
fromtkinterimport*
root=Tk()
defimprimir():
#print (varOpcion.get())#rescatando el valor seleccionado del radiobutton
ifvarOpcion.get()==1:
etiqueta.config(text="Has helegido masculino")
else:
etiqueta.config(text="has elegido femenino")
varOpcion=int=IntVar()#para obtener el valor del botton seleccionado
Label(root,text="genero: ").pack()
Radiobutton(root,text="Masculino",variable=varOpcion,value=1,command=imprimir).pack()
Radiobutton(root,text="Femenino",variable=varOpcion,value=2,command=imprimir).pack()
etiqueta=Label(root)#para mostrar un mensaje en el frame al seleccionar las opciones del radio buttoon
etiqueta.pack()
root.mainloop()