martes, 29 de octubre de 2019

Radiobutton Ejemplo 1

from Tkinter import *
tk = Tk()
variable = StringVar()
def prueba():
print("Se ha elegido la opcion" + variable.get())
radiobutton1 = Radiobutton(text="Opcion 1", variable=variable, value=1, command=prueba)
radiobutton2 = Radiobutton(text="Opcion 2", variable=variable, value=2, command=prueba)
radiobutton3 = Radiobutton(text="Opcion 3", variable=variable, value=3, command=prueba)
radiobutton1.pack()
radiobutton2.pack()
radiobutton3.pack()
variable.get()
tk.mainloop()
view raw radiobutton.py hosted with ❤ by GitHub

No hay comentarios:

Publicar un comentario