Creating RADIOBUTTONS in TKINTER
from tkinter import *
import tkinter.messagebox as tmsg
root = Tk()
def info():
tmsg.showinfo("Your Response", f"Your response is {rad_var.get()}. Thanks!")
root.geometry("700x400")
root.title("Radiobutton Tutor")
Label(root, text="What is your Blood Group?", font="verdana 17 bold").pack()
rad_var = StringVar()
rad_var.set("+")
Radiobutton(root, text="B+", value="B+", variable=rad_var).pack(anchor=CENTER)
Radiobutton(root, text="A+", value="A+", variable=rad_var).pack(anchor=CENTER)
Radiobutton(root, text="AB+", value="AB+", variable=rad_var).pack(anchor=CENTER)
Radiobutton(root, text="AB-", value="AB-", variable=rad_var).pack(anchor=CENTER)
Radiobutton(root, text="O+", value="O+", variable=rad_var).pack(anchor=CENTER)
Button(root, text="Submit", command=info).pack()
root.mainloop()
Comments
Post a Comment
Write something to CodeWithAbdur!