▶️ Watch Entire Tkinter Playlist ✅ Subscribe To My KZbin Channel: bit.ly/2UFLKgj bit.ly/2IGzvOR ▶️ See More At: ✅ Join My Facebook Group: Codemy.com bit.ly/2GFmOBz ▶️ Learn to Code at Codemy.com ✅ Buy a Codemy T-Shirt! Take $30 off with coupon code: youtube1 bit.ly/2VC9WUN
@shivamkalra42954 жыл бұрын
It's a teacher's day in India today. Happy teacher's day John! You have helped me here a lot. Great work.
@Codemycom4 жыл бұрын
Thanks!
@michaelduckworth33963 жыл бұрын
I love these videos. I refer back to these everyday to try and build my stuff
@Codemycom3 жыл бұрын
Glad you find them useful!
@zogoloov43135 жыл бұрын
you are amazing sir print('THANKS')
@Codemycom5 жыл бұрын
Thanks!!
@adihetvi3 жыл бұрын
Your videos are amazing...exactly what i want print("Thank you")
@Codemycom3 жыл бұрын
Glad you like them!
@KadeMccarroll Жыл бұрын
Thank you, I am learning tkinter right now and I wanted to let you know I am having trouble learning some of it, and you are good at explaining.
@Codemycom Жыл бұрын
Happy to hear it!
@nassimak28273 жыл бұрын
U make me love Python more and more ! Tkx for ur effort !
@kelceyfirth3 жыл бұрын
if name==“John”: print(“You are awesome and a great teacher!”)
@Codemycom3 жыл бұрын
print("Thanks!")
@ycanycan30652 жыл бұрын
Cok tesekkur ederim,emegine yureginize saglik.
@GeorgAubele Жыл бұрын
Thanks! Finally I understand that logic!
@Codemycom Жыл бұрын
Happy to hear it!
@girishjv10784 жыл бұрын
Print("thank u")
@Codemycom4 жыл бұрын
Sure thing
@victorga74 Жыл бұрын
Thanks for sharing Sir
@Codemycom Жыл бұрын
Welcome
@ttd9724 жыл бұрын
In this case it would be simpler to create a single label, with the attribute textvariable=pizza. Then it will always show which option is selected
@Codemycom4 жыл бұрын
lot's of ways to do it
@ttd9724 жыл бұрын
@@Codemycom yep, thanks for the great content!
@parsabahrambeik43814 жыл бұрын
Hi, thank you very much for your video.
@Codemycom4 жыл бұрын
Thank you too
@dipankarpanda84143 жыл бұрын
Superliked, Thanks.
@Codemycom3 жыл бұрын
Glad you liked it!
@mujtabashabbir31713 жыл бұрын
Amazing waiting
@Codemycom3 жыл бұрын
waiting for what?
@dubhe275 жыл бұрын
awesome, thanks!
@GurpreetSingh-td4es4 жыл бұрын
you just awsome sir make me code a lot better :-}
@Codemycom4 жыл бұрын
Thanks!
@mahdivatankhah54252 жыл бұрын
very good
@Codemycom2 жыл бұрын
Thanks!
@uskumru31062 жыл бұрын
Is possible to add multiple choices
@meow-hm7ni4 жыл бұрын
lambda looks like a capital L lol. got error on my code. good tutorial though.
@Codemycom4 жыл бұрын
yeah, that drives me crazy...I don't know why sublime does that
@smartconjurers25095 жыл бұрын
Nice video sir....
@Codemycom5 жыл бұрын
Thanks!
@sarthaksrivastava62824 жыл бұрын
how can we make the buttons deselect themselves if we click on them again? like I tried making a multi correct MCQ, I assigned different variables to different buttons so one can select multiple buttons but how to deselect if we click on it again??
@Codemycom4 жыл бұрын
Like I said, create a function that gets called every time the button is clicked that keeps track of the current state of the button and acts accordingly to deselect itself.
@advays98154 жыл бұрын
sir? can we display the options and not have the value that we set be displayed on the screen to the user?
@Codemycom4 жыл бұрын
Can't you tell from the video?
@akilamp84704 жыл бұрын
@@Codemycom I managed to figure it out. Thank you! Also can you tell me how to pass the value you get when you click a radiobutton in a seperate variable?
@letsarray57123 жыл бұрын
i want ask you, why you use lambda in your command?
@Codemycom3 жыл бұрын
Because that’s how it works.
@Harish-ou4dy4 жыл бұрын
I used grid to update the labels containing string, every time label gets updated there are some fragments of text of previous label seen beneath the current one (for ecample if first label was Pepperoni then next was egg), so "P" and "i" of Pepperoni will still be visible when egg is the new updated label.
@Codemycom4 жыл бұрын
look into the .destroy() function.
@chinmaykulkarni78354 жыл бұрын
So if I click a radio button it will consider one time entering in function or continuously as long as it is activated?
@durgeshchandrapatel59434 жыл бұрын
Only at the time when it is toggled like on or off.
@bassusdandoti30732 жыл бұрын
good
@lawrencetheguywithjustfact4767 Жыл бұрын
Please help. I am in a cybersecurity class and I have to make either a checkbutton or radio button and whenever I try it says there’s a Tcl error and means that Tcl wasn’t installed properly, but what is Tcl and how do I install it properly?
@Codemycom Жыл бұрын
use the tools I use and the code I write and you won't have errors like that
@ssigitas693 жыл бұрын
Hi. I have stupid question. IntVar, Radiobutton, title, Label, .get on your editor have blue color. I'm using Pycharm, how to change colors for Tkinter commands? Thanks
@Codemycom3 жыл бұрын
What could it possibly matter? Don't use pycharm
@mdzohaib73684 жыл бұрын
Sir can u tell me how to remove the current label nd whenever i click on any other radiobutton the label gets overwrite rather than showing its mode in next row?
@mdzohaib73684 жыл бұрын
I think there must be some command like label.rem smthng to remove the current label and replace in same row with other label whenever i click on other radiobutton.
@Codemycom4 жыл бұрын
You can usually .config things to change them.
@uvrays0454 жыл бұрын
If i click a button, how do i make the screen of the gui clear of ? Can u plz help ?
@infinitespace19823 жыл бұрын
Maybe, you could try opening another window with the same name, and delete the original?
@antukhan55924 жыл бұрын
do u have any other tutorial in youtube ?
@Codemycom4 жыл бұрын
Yes, I have hundreds: kzbin.info
@dead1ock2844 жыл бұрын
So i did the same as you with the for loop but i had 7 radio buttons, i even set the value of the radio buttons variable to '1' but every time i run the program, all the buttons are marked but when i click on one button then all of the buttons get unmarked like it needs to be. how do i fix this problem?
@Codemycom4 жыл бұрын
There's a problem with your code, but I don't know what.
@dead1ock2844 жыл бұрын
@@Codemycom never mind i managed to figure it out but thanks anyways for replying to my comment :)
@ogspeace4 жыл бұрын
is there a difference between root.mainloop() and just calling mainloop() ? i noticed that you used `mainloop()` instead of `root.mainloop()` starting w/ this vid (and onwards). also, do you have a tutorial on implementing tkinter in classes? (oop). thanks.
@Codemycom4 жыл бұрын
Videos with classes will be coming soon :-)
@dong89124 жыл бұрын
Great Video. I have one question though, When I tried to create radio buttons within a function, I can't seem to get the IntVar variable to change and it always stays as the default value, regardless of which radio button is selected. Is there a way to fix this?
@Codemycom4 жыл бұрын
I think there must just be a typo in your code
@dong89124 жыл бұрын
@@Codemycom Nope, no typos. My script includes 6 radio buttons in total, 3 of which are outside a function and the other 3 in a function - the function is called by clicking a button, which opens up a new window that contains the other 3 radio buttons. All radio button lines look exactly the same, with only the values and texts being different. I even tried using global variables but that still didn't work. I think it may be helpful to mention that i am also using IDLE to run my scripts
@dong89124 жыл бұрын
So I managed to fix this issue, and also a bunch of other issues relating to some widgets not working in a function-generated window. Essentially, The very first window opened in the script uses the command: root = Tk(). since I'm creating more than one window concurrently, instead of using: window = Tk() to create that window, I instead use: window = Toplevel(). Apparently tkinter is designed such that only one Tk() window can be opened at a time, and to open multiple windows, I need to use Toplevel(). But yeah this fixes the issue of the radio buttons not working. Also I just realised you already made a video covering this and that I totally forgot.
@Codemycom4 жыл бұрын
@@dong8912 Glad you got it sorted out!
@dong89124 жыл бұрын
@Codemy.com Thanks!
@kunalsah48954 жыл бұрын
hey, can we change color of dot in the radio button
@Codemycom4 жыл бұрын
When defining the radio button, try setting the selectcolor="red" or whatever color
@russiansouls73484 жыл бұрын
Can you create if statements using Radiobuttons
@Codemycom4 жыл бұрын
Of course
@rudraanshpatel5534 жыл бұрын
How can we bind radio buttons such that pressing certain keys selects those radio buttons, please make a video on this?
@Codemycom4 жыл бұрын
I have videos in the playlist on bindings
@durgeshchandrapatel59434 жыл бұрын
@@Codemycom You don't have any of them to bind radio buttons.
@durgeshchandrapatel59434 жыл бұрын
@@Codemycom I want to navigate between options of a quiz, like if I click a , a gets selected...
@yukidango67304 жыл бұрын
How can I get the text from the selected radiobutton and put it inside a normal variable??
@Codemycom4 жыл бұрын
Don't we discuss that? If not, check the playlist.
@nicovdt70742 жыл бұрын
I cant seem to get Lambda working is there a video where you explain it more?
@Codemycom2 жыл бұрын
you're mis-spelling lambda. It needs to have a lowercase l not L
@eddywilliams44654 жыл бұрын
"which is insanely cheap " tone makes me laugh🤣🤣🤣🤣🤣🤣🤣🤣
@Codemycom4 жыл бұрын
Ah, but did it make you buy? LMAO
@tszabon4 жыл бұрын
hi, how can I pass the value to variable when "Click Me" button is pressed and close checkbox window automatically?
@Codemycom4 жыл бұрын
I explain all of that in the videos in this playlist...
@richardbenny78913 жыл бұрын
my radiobutton does not deselect after choosing another one any solutions for the same??
@Codemycom3 жыл бұрын
You just have a typo somewhere
@Louis-zd2lw3 жыл бұрын
How to unclick ? and when it's clicked print 1 else 0
@fernandohood55424 жыл бұрын
How do you use the place() method with the radio button? The object is being created but not assigned to anything?
@Codemycom4 жыл бұрын
I never use place, but you use it with the radio button the same way you use it with every other widget.
@Aleinux3 жыл бұрын
Every time you click on the button, you get a new line whit the value of the radio button. If I want refresh the line and no insert a new line each time. How can I do?
@Codemycom3 жыл бұрын
button_name.config(text=whatever)
@hansquillrainford65832 жыл бұрын
I like you, can you reply me!!!
@leothomas11132 жыл бұрын
gender=StringVar() Radiobutton(root, text='Male', variable=gender, value='Male').place(x=150, y=220) Radiobutton(root, text='Female', variable=gender, value='Female').place(x=220, y=220) Both the radio buttons selected by default for me. How to resolve that ?
@Codemycom2 жыл бұрын
You didn't set them...rewatch the video.
@issamkessira8252 жыл бұрын
can any one please tell me how to disable the other radiobuttons once someone chooses onion?
@sushmachandran21794 жыл бұрын
my code doesn't like the "command =Lambda:" even though I have imported from _ast Lambda from _ast import Lambda from tkinter import * from PIL import ImageTk,Image root = Tk() r = IntVar() #r.set("2") def clicked(value): myLabel = Label(root, text=value) myLabel.pack() Radiobutton(root, text="Option 1", variable=r, value=1, command=Lambda: clicked(r.get())).pack() Radiobutton(root, text="Option 2", variable=r, value=2).pack() mainloop() It claims that Lambda is an invalid syntax.
@Codemycom4 жыл бұрын
Don't import Lambda. Your code needs lowercase l in lambda, not uppercase
@sushmachandran21794 жыл бұрын
@@Codemycom That fixed it. Thanks a ton!
@Codemycom4 жыл бұрын
@@sushmachandran2179 Sure thing
@PraptyChanda4 жыл бұрын
I have written the following code. I haven't set the value of r but still, in the beginning all the options are shown as selected. r = StringVar() Radiobutton(frame,text="option 1",variable=r,value="1").pack() Radiobutton(frame,text="option 2",variable=r,value="2").pack() Radiobutton(frame,text="option 3",variable=r,value="3").pack() I followed your code. In your output, it doesn't show selected if its not set. But I don't understand why in mine all the options are pre selected. Is there a way to remove those?
@Codemycom4 жыл бұрын
You need to set one.
@PraptyChanda4 жыл бұрын
@@Codemycom okay will try that. Thank you!
@pradnyeshprabhu44584 жыл бұрын
My radio buttons get selected even without clicking on it. Just move near to radio button and it gets selected moreover both get selected at a time i.e. one doesn't get unselected when other one is selecetd. Help me. Below is my code: from tkinter import * def script(): return r = IntVar root = Tk() root.title('Renaming Parts') textbox = Entry(root, width=50) textbox.grid(row=0, column=0, columnspan=4) Radiobutton(root, text='WIRE', variable=r, value=1).grid(row=2, column=0, columnspan=2) Radiobutton(root, text='COMPO', variable=r, value=2).grid(row=2, column=3, columnspan=2) Enter = Button(root, text='Enter', width=25, command=script).grid(row=3, column=0, columnspan=2) Exit = Button(root, text='Exit', width=25, command=root.destroy).grid(row=3, column=3, columnspan=2) root.mainloop()
@Codemycom4 жыл бұрын
Two things...your r=IntVar needs to be r = IntVar() you fogot the parenthesis. Next, make the radiobutton variable global. So above the RadioButton code, go: global r r = IntVar()
@pro_fessor. Жыл бұрын
Why using mainloop() Instead of root.mainloop() In las line
@Codemycom Жыл бұрын
should probably be root.mainloop()
@Harish-ou4dy4 жыл бұрын
strangely enough, text=r.get() doesnt work when using r as a StringVar(). Even after setting r.set="sample string"... Nothing shows up, when tried to check by print(r.get()), its a blank string.
@Codemycom4 жыл бұрын
r.set() not r.set
@Harish-ou4dy4 жыл бұрын
@@Codemycom BullsEye!! thanks ..
@Codemycom4 жыл бұрын
@@Harish-ou4dy good :-)
@shekhsaiful10544 жыл бұрын
I got an error it says list object doesn't have get attribute .. how to fix this
@Codemycom4 жыл бұрын
check your code for typos
@sudeepsanthosh88194 жыл бұрын
sir I am facing a problem for me when I open my window all the the radio buttons are already pre selected plss help
@Codemycom4 жыл бұрын
did you not change something in each of the radio button code?
@sudeepsanthosh88194 жыл бұрын
@@Codemycom no
@yukidango67304 жыл бұрын
I tried doing the StrVar() but it says it is an undefined variable
@Codemycom4 жыл бұрын
Check your code for typos
@yukidango67304 жыл бұрын
@@Codemycom I just corrected it, it isn't StrVar() it is StringVar() xD
@Codemycom4 жыл бұрын
@@yukidango6730 ;-)
@just_all_in4 жыл бұрын
my button does not deselect when I click the other
@Codemycom4 жыл бұрын
Check your code for typos
@just_all_in4 жыл бұрын
@@Codemycom my code is from tkinter import * root = Tk() root.title('EX001') r = IntVar Radiobutton(root, text='op01',variable=r,value=1).pack() Radiobutton(root, text='op02',variable=r,value=2).pack() mainloop()
@subhasiz4 жыл бұрын
Sir , I'm getting AttributeError: 'NoneType' object has no attribute 'get'
@Codemycom4 жыл бұрын
you need to do .get() not .get and make sure not to .pack() on the same line
@subhasiz4 жыл бұрын
Thank you sir, it worked
@Codemycom4 жыл бұрын
@@subhasiz Great!
@alitalhaoylek24134 жыл бұрын
Why we can't .pack() at the same line?
@Codemycom4 жыл бұрын
Because it confuses tkinter if there's a function to call.
@alitalhaoylek24134 жыл бұрын
@@Codemycom thanks
@Codemycom4 жыл бұрын
@@alitalhaoylek2413 sure thing
@Skyvastern5 жыл бұрын
lol the name of your PC is flatplanet? Didn't know that you were a flat earther 😁
@Codemycom5 жыл бұрын
I'm not, I just find it hilarious that some people do so I named my computer that lol
@Skyvastern5 жыл бұрын
@@Codemycom yeah I got that feeling that it was named as a joke xD
@rudraanshpatel5534 жыл бұрын
Seems like you have crammed your advertisement. '''Which is insanely cheap xD'''
@Codemycom4 жыл бұрын
huh?
@borgyoh5 жыл бұрын
Second
@Codemycom5 жыл бұрын
ha!
@durgeshchandrapatel59434 жыл бұрын
Can you please review my code.?
@Codemycom4 жыл бұрын
Sorry I don't do that
@furive4 жыл бұрын
Some error about command=Lambda:
@Codemycom4 жыл бұрын
lambda should be lowercase
@shubhankarpanda96873 жыл бұрын
how to destroy radio buttons?
@Codemycom3 жыл бұрын
.destroy()
@shubhankarpanda96873 жыл бұрын
@@Codemycom it is not working in for loops as well as in single creation
@shubhankarpanda96873 жыл бұрын
@@Codemycom can you please refer some documentation on this
@Codemycom3 жыл бұрын
@@shubhankarpanda9687 Check my playlist...I have videos on destroy.
@shubhankarpanda96873 жыл бұрын
@@Codemycom ok sir thank you
@raz8655 жыл бұрын
First lol
@Codemycom5 жыл бұрын
Ha!
@bxstiii4 жыл бұрын
Can I Copy this code?? Please send the Code
@Codemycom4 жыл бұрын
Don't be lazy.
@bxstiii4 жыл бұрын
@@Codemycom have now written to me the code and it has helped me can you be reached on discord ??