Python GUI Tutorial - 24 - Radiobutton | Tkinter

preview_player
Показать описание
In this video, you'll learn about Radiobuttonsin Tkinter. It is very easy to create and use Radiobutton in TKinter.

Here is the example -

from tkinter import *

def click_me():

root = Tk()

i = StringVar()
r1 = Radiobutton(root, text="male", value="radio 1", variable=i)
r2 = Radiobutton(root, text="female", value="radio 2", variable=i)

button = Button(root, text="check", command=click_me)

-------------------------------------------------------

i am sure your queries like-
- how to create radiobutton in tkinter?
- how to create radio buttons in tkinter?
- how to craete Radiobutton in tkinter in hindi?
- how to get value from Radiobutton in tkinter?
- how to know whether Radiobutton is clicked or not in tkinter?
- how to checked or unchecked radio button in tkinter?
- how to get string value from a radio button after clicked or unclicked?
- how to fetch the value of radiobutton on clicking a button in tkinter?

have been solved.


If you have any problem related with this video then please let us know in comment box. we'll reply as soon as possible.

Thanks.

contact us
Рекомендации по теме
Комментарии
Автор

One thing to check is that when you are placing the function name in the command inside button, be cautions to place it like click_me rather than click_me() as in that case the function would be called only once and even of you change the radio button there won't be any effect . I learned this the hard way . So dropping this comment .

jaggarnot
Автор

Sir in StringVar() my application is showing selected both the options. why?

sukhvindersingh
Автор

Bro please ans me code work ho Raha he lekin dusre code ke sath value 0 ho jati he or shirt ye code run karu to fir value aa rahi he

ROYGROUPGAMING
Автор

thnq bhai kahi par bhi aacha accha content ni mila

basantchoure
Автор

Sir in StringVar() my application is showing selected both the options. why?


my code are:-


from tkinter import *
root=Tk()
def new():
print(i.get())

i=StringVar()
root.geometry("400x300")
r1=Radiobutton(root, text="male", value="radio 1", variable=i)
r2=Radiobutton(root, text="female", value="radio 2", variable=i)
r1.pack()
r2.pack()
b=Button(root, text="click me", command=new)
b.pack()
root.mainloop()

niranjankumar-fsre
Автор

Sir if you know flutter, , please make video on it

rajdave
Автор

mujay background color white krna hai krti hun to jb kuch select kro to selection show ni hoti

zahrazaidi