Tkinter Course – Create Graphic User Interfaces in Python Tutorial
Learn Tkinter in this full course for beginners. Tkinter is the fastest and easiest way to create the Graphic User Interfaces (GUI applications) with Python. Tkinter comes with Python already, so there's nothing to install!
?Code:
?Course created by Codemy.com. Check out their YouTube channel:
⭐️Course Contents ⭐️
⌨️ (0:00:00) Intro to Tkinter
⌨️ (0:10:32) Positioning With Tkinter's Grid System
⌨️ (0:19:29) Creating Buttons
⌨️ (0:29:30) Creating Input Fields
⌨️ (0:38:51) Build A Simple Calculator App
⌨️ (1:18:19) Using Icons, Images, and Exit Buttons
⌨️ (1:27:42) Build an Image Viewer App
⌨️ (1:49:37) Adding A Status Bar
⌨️ (1:59:45) Adding Frames To Your Program
⌨️ (2:07:49) Radio Buttons
⌨️ (2:24:36) Message Boxes
⌨️ (2:35:31) Create New Windows in tKinter
⌨️ (2:44:30) Open Files Dialog Box
⌨️ (2:56:09) Sliders
⌨️ (3:08:25) Checkboxes
⌨️ (3:17:29) Dropdown Menus
⌨️ (3:23:50) Using Databases
⌨️ (3:32:28) Building Out The GUI for our Database App
⌨️ (3:59:48) Delete A Record From Our Database
⌨️ (4:15:18) Update A Record With SQLite
⌨️ (4:42:57) Build a Weather App
⌨️ (5:04:32) Change Colors In our Weather App
⌨️ (5:16:36) Add Zipcode Lookup Form
⌨️ (5:26:22) Matplotlib Charts
—
Learn to code for free and get a developer job:
Read hundreds of articles on programming:
And subscribe for new videos on technology every day:
Hello Mr John,
I want to give you the explanation of the strange behavior of checkbutton when we use string value instead of integer value.
the line of code concerned is:
c = Checkbutton(root, text=”Check this …”, variable=var, onvalue=”On”, offvalue=”Off”)
when you used an integer value, possibles values are 0 or 1, and the default value for integer is 0, it is why by default it is unchecked; but when you used string value and you defined the values “On” and “Off”, the default value for a string is an empty string “” which doesn’t exist between the 2 values you choosed; that means that the checkbutton starts with neither the value corresponding to unchecked nor the value corresponding to checked.
To correct this, we can initialize the string variable with, for the example, “On” (if we want it to be checked initialy) or “Off” (if we want it to be unchecked initialy).
var.set(“Off”)
cordially
Hey everyone, creator of the video here. If you enjoyed this free course, check out my website Codemy.com and consider subscribing to my Youtube channel for tons more coding content!
✅ Subscribe To My YouTube Channel: http://bit.ly/2IGzvOR
▶️ Check Out My Website: https://Codemy.com
Lol
Hi can anyone help me please
When creating that image viewer, is there any way we can use a folder at once rather than using all the pictures 1 by 1
This is really great
I Need ur help
you could have arranged it more properly it’s ok
Can we take a minute to respect this man who did a lotta work and gave it all with no ads
I’m getting adds he sold out lol
Thanks you so much sir
I got an ad
NO! have ads
Yes, thank you so much to John Elder for this succinct and informative video. It’s helped me immensely. I’ve watched it over many times.
Thank you Walter White for this course. From Chemistry to Coding, I appreciate your journey.
?
if anyone was wondering at 2:57:25 why the from_ parameter needs an underscore at the end, it’s because “from” by itself is a reserved word in Python (used in things like from Tkinter import messagebox, for example). Using a reserved word to have a completely different meaning would be problematic, so the developers of Tkinter added an underscore at the end to differentiate it from the original “from”.
Just a tip: When creating the calculator, in the button_click function, you don’t need three lines of code. The only line of code you need is e.insert(END, number). It works too.
noted, thank you
If anyone has trouble around 53:15, he’s using a lowercase “L” when he types out “lambda”
For whatever reason, his text editor changes the font, and it just looks like a capital L.
you are a Hero ty man
THANK YOU SO MUCH
You, my man, are a hero
Thx
Yeah
note for around 1:02:04 when he decides to use a global variable: if you want to avoid using globals (and just make the whole calculator project a lot simpler), you could just have the calculator show the entire expression when you type it, instead of clearing the Entry field when one of the arithmetic operator buttons are pressed. This way, your program doesn’t need to remember anything, and can just read what’s in the Entry field when the equal button is pressed, and use eval(expresion_as_a_str) to evaluate the whole function easily.
I’d also recommend making a function to create all the buttons so that you don’t need to copy basically the same line a bunch of times only to change the value and placement of the button.
Using partials (from functools import partial, then command=partial(myFunction, argument)) is also a helpful way to pass arguments to the button commands.
With all this, the calculator project becomes a lot shorter to code and has all the same functionality. I wrote one that supports addition, subtraction, multiplication, division, exponentiation, decimals, and order of operations in 50 PEP 8-compliant lines haha, and I’m sure it could be done in fewer!
Isn’t the use of eval() considered a bad practice?
I have a problem in the global could u help me?
can u show an example
Thanks for the help, i was new into tkinter and knew the eval expression, it just made it so easy.
Gonna research on the partials function and will try to learn.
Although he does a lot of those ineffective “fixing a clock by putting a clock over a clock” thing, he is still pretty clear in his teaching. I’m very appreciative of that. Yes, It’s annoying to see something so simple become complicated, but for me it just leave a space for me to do better and applying skills I know to improve upon the projects.
3:15:00 I think the reason why this is happening is because the var variable that we have created before, doesn’t have a value, but the c (checkbutton)’s variable is set to the var, because var doesn’t have value in it, so the checkbutton dont know what to empty var. If you set the var’s value by using var.set(“On”) / var.set(“Off”), the button will actually work as intended.
I don’t normally do this, but am forced to come back and say “THANK YOU VERY VERY MUCH” you mixed happiness with expertise, is so much fun watching your tutorials. I have subscribed already. A BIG THANK YOU ONCE MORE.
Thank you John! The tkinter documentation on python.org left me feeling lost, perhaps even in over my head. But this lesson is very good, and now I feel like I can make Python GUIs! I coded along using VS Code, adding comments about the sometimes-tricky syntax needed for certain widgets. This leaves me with a great reference for future programs.
At first, I was annoyed that John didn’t edit out his typo errors and subsequent corrections. But then I realized that this was more a “feature” than a “bug”, as it teaches how to interpret the Python error messages and such.
Note: I skipped the sections “Using Databases” through “Add Zipcode Lookup Form”, as they are probably not relevant to me, so they are not covered by this review.
this is the best tutorial ever… thank sir. i enjoyed the fact that you also used try and error. you weren’t sure at some things. that made me feel the liveliness of the lessons
thanks so much…
Yeah it can definitely be nice to be reminded that perfection does not exist.
Thank you very much for this amazing simple and very well explained training.
This was AWESOME! You have clearly and jovially explained the topics making it easily understandable all the while keeping the viewer engaged. Thank You.
Totally agree and I’m only a little bit into it. Some people are natural born teachers.
Thank you so much for this tutorial! I had to create a basic GUI-based python executable and this tutorial was really useful to me!
This was such a great tutorial on python GUIs. Happy I found this. I learnt overall, how to build GUIs, how to understand bugs and kind of correct them and as well, different programmatic approaches to creating solutions.
3:40:02 if someone has a problem here with *”AttributeError: ‘NoneType’ object has no attribute ‘delete'”*
Don’t do
l_name = Entry(root, width=30).grid(row=1, column=1, padx=20)
but
l_name = Entry(root, width=30)
l_name.grid(row=1, column=1, padx=20)
it works then
I looked everywhere for this answer! I was wondering why my version didn’t work but his did ! Thank You!
did u got any indent error in submit function ?
The reason this works with two lines is because Entry returns a object but grid does not.
Thanks, bro that was helpful
thanks
MAN! this saved my day, I’m totally new on py and this is awesome, I’ve been trying to figure out to do the same for some code I need to use while working and this is awesome!. appreciate it, awesome!
What an awesome free course! Thank you so much for this. Took me a while to work through it. But its brilliant the way you broke it up into bite size snippets so that I can do it bit for bit as I find time. Finally finished this and I am really enjoying playing with Tkinter.