▶️ 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
@Codemycom2 жыл бұрын
@ANONYMOUS Sure, use the .set() function with whatever value you want. .set(20) etc
@TheRevan55764 жыл бұрын
10:00 You can fix this problem easily by binding your function to take place after you release the mouse, place the code before you call .pack() horizontal.bind("", lambda var=event: slide(var))
@Codemycom4 жыл бұрын
Of course, there's always many ways to do a thing
@sunchitlakhanpal4 жыл бұрын
The best Tkinter tutorials out there, Great Job ! :D
@Codemycom4 жыл бұрын
Thanks man!
@walternyc4 жыл бұрын
I put together a simulation in tkinter. Your GUI tutorials have been extremely useful. Thanks!
@Codemycom4 жыл бұрын
Glad you liked them!
@jscherer264 жыл бұрын
These are great. My first time with GUI. Thank you for making them. horizontal.pack(anchor=W) will solve your slider issue. It's centered, so as your moving it, it's recentering. If it stays to the left its fine.
@dylancampbell64333 жыл бұрын
Yes, also if you are a fan of the side option you could use that as well. Example: vertical.pack(side=RIGHT, fill=Y) horizontal.pack(side=BOTTOM, fill=X) fill makes the slider expand with the window.... you know.... for style points 😎
@Abdulkadir-vb3vj3 жыл бұрын
9:58 the reason for resizing weirdness is that there is keydown and keyup difference. You need to use a key up(key release). So, delete command area in horizontal and add another line under it horizontal.bind("", get_value)
@MonkeyDLuffy-ld5iy4 жыл бұрын
You need a "_" and the end of the " from_" parameter because the is a buildin keyword from in python like "from tkinter import *"
@Codemycom4 жыл бұрын
yeah
@ninjatribble79614 жыл бұрын
Smashing through this playlist. Great stuff. Looking forward to the database vids.
@Codemycom4 жыл бұрын
fun!
@devjeetmandal14723 жыл бұрын
At 2:00, 'from_' is used because 'from' is a keyword in Python, it's like to differentiate between keyword and the slider variable.
@Codemycom3 жыл бұрын
yep
@AyanKhan-dc3eu4 жыл бұрын
It's amazing sir learning bunch of cool stuff during quarantine
@Codemycom4 жыл бұрын
Glad you're enjoying it!
@react_meme3 жыл бұрын
1:58 cuz there is something in python called from and if u use from except of from_ python wont get witch one do u mean
@aidangurevich99044 жыл бұрын
Your tutorials are very helpful! I was just wondering how you can adjust the length of the slider.
@Codemycom4 жыл бұрын
give it a length of some number; ie length=600
@aidangurevich99044 жыл бұрын
@@Codemycom Thank you!
@Codemycom4 жыл бұрын
@@aidangurevich9904 Sure thing!
@mm333-e1t5 жыл бұрын
Concepts are beautifully explained. This is good stuff... Great job man !!
@Codemycom5 жыл бұрын
Thanks! Glad you're enjoying it!
@TheOleHermit4 жыл бұрын
Excellent series! I'm building a GUI for a RPi security camera with stepper motors controlling X/Y position, zoom, focus, and aperture. Your previous tutorials showed me how to input x and y values into text boxes, then use a button to send those +/- step values to the steppers. Great! Now, I'm ready to add some x/y preset buttons with 10 stored values, pulled from a csv file. Awesome! These sliders should allow me to also control the zoom, focus and aperture steppers. Almost home! Q: Is there a way to display the camera's live image as a background, with a hot spot to show/hide the GUI controls? That would be the cherry on the cake.🥳 Thanks for posting tutorials that make these things happen.🙏
@Codemycom4 жыл бұрын
I'm sure there is, but not knowing anything about that camera, I couldn't guess how..
@TheOleHermit4 жыл бұрын
@@Codemycom Thanks for the quick reply. It's a simple RPi USB camera. Just googled it and found the following article, which looks promising. I'm not so sure about a hotspot for hide/show GUI. But, where there's a will, there's usually a way. Might need to simply switch between windows, tabs, or something. 😎 solarianprogrammer.com/2018/04/21/python-opencv-show-video-tkinter-window/
@kocorech4 жыл бұрын
is possible to change the way slider looks? other than just changing the color or size?
@Codemycom4 жыл бұрын
not this slider
@kocorech4 жыл бұрын
@@Codemycom so in tkinter is there any other slider types? I am asking because i am trying to build a music player with it and this one just looks horrible. I am trying to decide based on that if i should go with pyqt5 instead.
@Codemycom4 жыл бұрын
@@kocorech ttk has a scale widget that might be a little better.. we've used ttk comboboxes but I haven't talked about scale yet
@Blubberland2 жыл бұрын
1:56 because it's a python keyword. That's very essential for a course on a language and something you could've and should've corrected since april '19 €: I commented before reading the other comments. After reading the reaction Devjeet Mandal I felt even more, that this should be said.
@keerthivaasannandakumar99743 жыл бұрын
We have to add an underscore after from i.e. from_ because from is a pre-defined function
@barackuse Жыл бұрын
Why do you need the "orient =horizontal," and does horizontal need to be all in caps? I noticed that this still was not done on the vertical slide.
@Codemycom Жыл бұрын
really? Because that's how you orient the slider horizontally... come on man.
@darshanbothra26733 жыл бұрын
suggestion: using grid with horizontal and vertical will actually remove the lag thing..
@SatishKumar-mn6bi4 жыл бұрын
I am facing problem to complete my project for multiply table in gui in which we take int input from user. Further we take int input for both range and display results. All to be on gui, we will take 3 input and then results display
@MrGerrardo6814 жыл бұрын
very cool video, i was wondering how you could connect the number you get from the slider in the GUI, into a database field. for instance shirt number.
@Codemycom4 жыл бұрын
The same way you connect any variable to a database field
@djilytech3854 жыл бұрын
@@Codemycom you can do var1 = horizontal_slider.get() var2 = vertical_slider.get() Then when you do INSERT, include var1 and var2 etc..
@Codemycom4 жыл бұрын
@@djilytech385 cool
@KineticPebble3 жыл бұрын
I don't understand why we need to pass in parameter to the slide function? We are not using the parameter in the function and also not passing it in the command for the horizontal slider. Shouldn't it give a missing argument error?
@mikemurphy18963 жыл бұрын
you are da man, thx
@Codemycom3 жыл бұрын
Thanks!
@furrane2 жыл бұрын
FYI : The command inside the Scale will pass the scale value. Which means you could use this in your code for example : def slide(n): root.geometry(str(n)+'x400')
@sudinmaharjan93264 жыл бұрын
how u got that multiply sign because in my case i have * sign and it say this is a bad geometry specifier and i get a TclError
@Codemycom4 жыл бұрын
try the x instead not *
@liyudanfikirdan12214 жыл бұрын
thank you, i am 12 years old and i like your videos
@Codemycom4 жыл бұрын
Awesome, thanks for watching!
@geojose50454 жыл бұрын
Can we From and To as strings?
@Codemycom4 жыл бұрын
try it and see
@geojose50454 жыл бұрын
@@Codemycom it doesn't work. Only numerical values
@Codemycom4 жыл бұрын
@@geojose5045 yep
@geojose50454 жыл бұрын
@@Codemycom sir when I try to place radio buttons using grid, they are aligned correctly? Why is that?
@Codemycom4 жыл бұрын
@@geojose5045 I don't know what you mean
@xith-eb1jeevanraj.l4858 ай бұрын
I have running problem with horizontal.get( ) , it shows this object show no attribute
@Codemycom8 ай бұрын
did you define the widget and pack it on the same line? You can't do that.
@stephenmascarenhas35954 жыл бұрын
Well can i do it with pycharm
@Codemycom4 жыл бұрын
I don't use Pycharm, or recommend it to anyone ever.
@fentonmsu4 жыл бұрын
Why not,?
@Codemycom4 жыл бұрын
@@fentonmsu Because it's garbage, and creates many problems for new coders.
@franciscovialli31832 жыл бұрын
When i write parameter var inside the slide() it shows that slide requires misses 1 position argument
@Codemycom2 жыл бұрын
What did you do differently from the video?
@franciscovialli31832 жыл бұрын
@@Codemycom nothing at all i just wrote def slide(var): that's all and it showed an error
@Codemycom2 жыл бұрын
@@franciscovialli3183 Hm, weird.
@parsabahrambeik43814 жыл бұрын
Hi, thank you very much for your video.
@Codemycom4 жыл бұрын
So nice of you
@maxwellhawk2 жыл бұрын
i think the problem with changing size with slider bc when it change windows size, center of the window change and slider position change, however u keep holding same old spot. That's pretty much why its blinking. If we put slider in frame and grid it or use sticky to left top corner, it should work just fine.
@johnjoe7803 Жыл бұрын
Not really is bc he is using the .pack that's why it centred in the middle by default.the .grid is use to place it anywhere in the window
@oilartxikia7884 Жыл бұрын
hey, can anyone help me? i try doing " mylabel = Label(settings,text = Horizontal.get()).pack() " or " Volume = Horizontal.get() " but it comes up with the error: Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\User\AppData\Local\Programs\Thonny\lib\tkinter\__init__.py", line 1921, in __call__ return self.func(*args) File "", line 29, in Test_Audio AttributeError: 'NoneType' object has no attribute 'get' can anyone help me? what have i done wrong? EDIT: i read through the comments and i understand what i did wrong, but now how would i set the value to a standard value, for example, when i first load the page, i want the volume to be set to 50, so its like half way.
@Codemycom Жыл бұрын
don't ever .pack() a widget on the same line you define it.
@gurucharan56184 жыл бұрын
How to adjust the length of the scroll bar ? (I'm not talking about width)
@Codemycom4 жыл бұрын
if not width, what ARE you talking about?
@rajkumarshirol78323 жыл бұрын
When I assign root=Tk(), the error shows "no display name and no $DISPLAY environment variable" someone please help. I need to submit my assignment tommorrow. I need to create a slider to plot graphs.
@Codemycom3 жыл бұрын
The code must be exactly the same as the video...you have a typo somewhere
@Zhaxxy Жыл бұрын
you probably dont read the comments anymore, but how can i make a slider that has 2 different colours, like if its fully empty it would be red and if full it would be green, the slider would be red to the right of the knob, and green to the left of the knob
@Codemycom Жыл бұрын
You'd have to probably create a custom style() widget...or use ttkbootstrap or something
@Zhaxxy Жыл бұрын
@@Codemycom i ended up making a canvas with a colour and a rectangle. i used the motion bind
@Codemycom Жыл бұрын
@@Zhaxxy nice
@mbbbbbbbbb6582 Жыл бұрын
Hi why does it say error Scale isn’t defined in my code
@Codemycom Жыл бұрын
Because you didn't define Scale in your code...compare your code to the video to see what you did wrong.
@leamlisophara7313 жыл бұрын
Excuse me!!! Could you explain what difference between slide and slide() ???
@Codemycom3 жыл бұрын
() generally denotes a function in python
@pranavbhat72624 жыл бұрын
How do I add a vertical scroll bar?
@Codemycom4 жыл бұрын
Set the widget’s yscrollcommand callbacks to the set method of the scrollbar. listbox = Listbox(master, yscrollcommand=scrollbar.set) And..Set the scrollbar’s command to the yview method of the widget. scrollbar.config(command=listbox.yview)
@pranavbhat72624 жыл бұрын
@@Codemycom Thank you so much sir... I really enjoy watching ur helpful tutorials
@Codemycom4 жыл бұрын
@@pranavbhat7262 Glad you enjoy them!
@sara-ql1xs5 жыл бұрын
Thanks man
@Codemycom5 жыл бұрын
You got it!
@SatishKumar-mn6bi4 жыл бұрын
I am watching KZbin which are really good as tutorial
@Codemycom4 жыл бұрын
:-)
@sveinndagur5 жыл бұрын
Good stuff!
@Codemycom5 жыл бұрын
Thanks!
@NEXC3 жыл бұрын
HOW can we change the slider button ?
@Codemycom3 жыл бұрын
What do you mean?
@NEXC3 жыл бұрын
@@Codemycom How to change the slider icon to our custom icon and how to resize the slider because this is too small
@Codemycom3 жыл бұрын
@@NEXC I have videos on that in the playlist
@alekhyobanerjee20995 жыл бұрын
Please show how to add Scrollbar for a login like page
@Codemycom5 жыл бұрын
Sorry I don't know what you mean by login like page
@rokkuzner3 жыл бұрын
How to resize scale?
@Codemycom3 жыл бұрын
what do you mean?
@luisjoa65352 жыл бұрын
adópteme señor
@ruturajpatil86894 жыл бұрын
AttributeError: 'NoneType' object has no attribute 'get' Please tell solution
@Codemycom4 жыл бұрын
You can't pack and define a widget on the same line. Break them into two lines
@ruturajpatil86894 жыл бұрын
Thank you sir it worked....
@Codemycom4 жыл бұрын
@@ruturajpatil8689 Good :-)
@hamakhdir66104 жыл бұрын
the reason of using from_ , because from is a python keyword!
@Codemycom4 жыл бұрын
Yep
@GameXaadict10 ай бұрын
. Get function is not working
@Codemycom10 ай бұрын
lowercase g in .get() - it can't not work.
@GameXaadict10 ай бұрын
@@Codemycom tried it multiple times but still it's not working...
@slobodantajisic27624 жыл бұрын
I played with this a little bit. This may be useful. Or not, but anyway: from tkinter import * root = Tk() root.title("Learning to Code") root.geometry("180x180+0+0") def ver(vertical_value, horizontal_value): root.geometry(str(horizontal_value) + "x" + str(vertical_value) + "+0+0") vertical_label["text"] = str(vertical_value) def hor(vertical_value, horizontal_value): root.geometry(str(horizontal_value) + "x" + str(vertical_value) + "+0+0") horizontal_label["text"] = str(horizontal_value) vertical = Scale(root, from_=180, to=830, command=lambda x: ver(vertical.get(), horizontal.get())) vertical.grid(row=0, column=0) horizontal = Scale(root, from_=180, to=1600, orient=HORIZONTAL, command=lambda x: hor(vertical.get(), horizontal.get())) horizontal.grid(row=0, column=1) vertical_label = Label(root, text=vertical.get()) vertical_label.grid(row=1, column=0) horizontal_label = Label(root, text=horizontal.get()) horizontal_label.grid(row=1, column=1) root.mainloop()
@pratyushmisra25164 жыл бұрын
ur code is really great!!!!! but i believe its not required to create 2 different function, here is the modified code: from tkinter import root = Tk() root.title("Learning to Code") root.geometry("180x180+0+0") def newGeometry(vertical_value, horizontal_value): root.geometry(str(horizontal_value) + "x" + str(vertical_value) + "+0+0") vertical_label["text"] = str(vertical_value) horizontal_label["text"] = str(horizontal_value) vertical = Scale(root, from_=180, to=830, command=lambda x: newGeometry(vertical.get(), horizontal.get())) vertical.grid(row=0, column=0) horizontal = Scale(root, from_=180, to=1600, orient=HORIZONTAL, command=lambda x: newGeometry(vertical.get(), horizontal.get())) horizontal.grid(row=0, column=1) vertical_label = Label(root, text=vertical.get()) vertical_label.grid(row=1, column=0) horizontal_label = Label(root, text=horizontal.get()) horizontal_label.grid(row=1, column=1) root.mainloop()
@slobodantajisic27624 жыл бұрын
@@pratyushmisra2516 Yes of course. I see now. Just edit the variables vertical and horizontal. Command attribute.Thanks....
@jeremydeceuster69124 жыл бұрын
I assume 'from_' is used because 'from' is a Python keyword.
@Codemycom4 жыл бұрын
Yep
@yeknom5g3 жыл бұрын
I tried "to_=200", instead of "to=200". It worked well here, and hopefully won't break anything in the future. Oops! fixed.
@Codemycom3 жыл бұрын
I don't see the difference between the two things you typed.
@Ty1er4 жыл бұрын
❤️
@Codemycom4 жыл бұрын
Thanks!
@slobodantajisic27624 жыл бұрын
from is a keyword in python, so here we have from and underscore...
@Codemycom4 жыл бұрын
huh?
@slobodantajisic27624 жыл бұрын
@@Codemycom The BeautifulSoup class from the bs4 module has a find method, which receives the keyword argument class_. I read that the underscore is because class is a special keyword in Python and that in such cases we put the underscore. If they lie to me then I lie to you. :-)
@Codemycom4 жыл бұрын
@@slobodantajisic2762 Ok, but I still have no idea what you're talking about or why
@slobodantajisic27624 жыл бұрын
@@Codemycom Haha. Ok. At 2:00 you said "I have no idea why you need an underscore, but you do and then you need to designate 'to' and notice there is no underscore for 'to' which doesn't make sense. I mean let's be consistent here people. I don't know who built this." No big deal.
@Codemycom4 жыл бұрын
@@slobodantajisic2762 ah, ok...yes from is a reserved word in python
@gamertronky86482 жыл бұрын
why TKinter its not Tkinter?
@abkani42793 жыл бұрын
Say my name, Heisenberg!!!
@Codemycom3 жыл бұрын
Haha
@mrj69673 жыл бұрын
unlike previous videos it was not that practical!!!
@Codemycom3 жыл бұрын
lol you are incorrect
@brycebolton176 ай бұрын
haha i was waiting for the root.geometry since the first video, but i didn't want it to look up just waited for it's appearing in the series :D