How to Program a GUI Application (with Python Tkinter)!

preview_player
Показать описание
Learn data skills with hands-on exercises & tutorials at Datacamp!

In this video, we learn how to build an application with a graphical user interface (GUI). This is a great video to learn how to use the Tkinter library as well as be introduced to some very important Python skills.

We start off by introducing the fundamentals of the Tkinter library. We then create a frame for a weather application. We then connect it to a weather API and then finally convert the application to an executable file.

Source code:

Follow me on social media!

TKinter Documentation:

Hope you enjoyed the video! Make sure to like and subscribe if you haven't already :)

Join the Python Army to get access to perks!

----------------------
Some potentially useful videos...

API overview (not my video):

Working with JSON in Python (not my video):

Installing Python:

Python Tutorial #1:

----------------------
Video timeline!
0:00 - What we’re ultimately building
2:05 - Getting started
3:16 - The basics of every Tkinter App (Root)
4:44 - Add a button to the screen
6:20 - Passing in keyword arguments
10:07 - Using frames to organize widgets
11:53 - Setting custom colors
14:00 - pack() to place widgets
17:39 - grid() to place widgets
19:53 - place() to place widgets
25:49 - Setting the appearance of our final application
33:45 - Adding background image
36:00 - Implementing button/entry functionality
39:49 - Connecting to the Weather API
43:29 - Making a GET request
51:36 - Formatting our response
56:24 - Changing Font and Font Size
59:58 - How to add weather icons to the app
1:01:36 - Making our App an executable using PyInstaller

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

*I use affiliate links on the products that I recommend. I may earn a purchase commission or a referral bonus from the usage of these links.
Рекомендации по теме
Комментарии
Автор

Video Outline!
0:17 - What we’re ultimately building
2:05 - Getting started
3:16 - The basics of every Tkinter App (Root)
4:44 - Add a button to the screen
6:20 - Passing in keyword arguments
10:07 - Using frames to organize widgets
11:53 - Setting custom colors
14:00 - pack() to place widgets
17:39 - grid() to place widgets
19:53 - place() to place widgets
25:49 - Setting the appearance of our final application
33:45 - Adding background image
36:00 - Implementing button/entry functionality
39:49 - Connecting to the Weather API
43:29 - Making a GET request
51:36 - Formatting our response
56:24 - Changing Font and Font Size
59:58 - How to add weather icons to the app
1:01:36 - Making our App an executable using PyInstaller

Hope you guys enjoyed! Make sure to subscribe if you haven’t already :)

KeithGalli
Автор

Finally, i programming tutuorial from someone with a sense of humor and a voice thats louder than 2db, and the tutorial is really understandable

kckph
Автор

Definitely the best tutorial yet. I'm not exactly a novice but the fact that you took your time explaining "Why" you chose to do things a certain way was for sure something missing from other tutorials and will help a lot of people.

charlietame
Автор

I'm a 66 yr old and was not going to try learning python; but this video got me interested and running down the rabbit hole. Nicely Done!

jdsguam
Автор

This is the best video on Tkinter I've ever seen. Thank you so much, I'm definitely sharing this one with whomever may find this useful. Good work!

ivanllopis
Автор

It is much easier to understand when a person explains syntax in his own words. Awesome video, thanks !

ArtuursPaulausks
Автор

For people trying to this program while following him along, if you're not using sublime text you may have problems with the request function. In order for it to work go on command prompt and type "pip install requests" and then go to your code and "import requests".


Hope this helped if you were stuck on this!

ActuallyAudacity
Автор

This was the second video of yours I’ve watched and I’ll be watching more. You speak *naturally* - you’re not reading from a script or mumbling; it’s like I’ve just sat down with you and you’re showing me something. Also, when stuff doesn’t happen just right the first time - that’s VERY real life - you’re modeling what to do - don’t panic just go back over stuff and figure out what you did wrong. Easy-peasy! I love this style of teaching, thanks.

truepenny
Автор

He is teaching us by learning simultaneously which makes the video more natural. That's why I subscribed to him... Great job Keith. Keep going. Greetings from Turkey...

direndeniz
Автор

You're a wonderful teacher. Only just getting started in Python and you manage to make all the concepts incredibly easy to understand. Not only that, you're always going in and explaining why you're doing something, providing a real kick-start to the learning process. Thank you for uploading this!

TheKhashix
Автор

The documentation "out there" is not very effective. Your video is super.

AspartameBoy
Автор

If you'll getting a syntax error with the "Lambda:" code, try using lowercase L in "lambda:"

justinmcdonald
Автор

What makes this tutorial better than any other tutorials on tkinter I have seen is, that you import the module as tk and not as * so that one can distinguish the tk calls from all the other stuff at first sight. You also don´t put everything in a class like many tutorials out there which only complicates things.
I haven´t seen anyone else describe the place-function - which is a great tool to make the gui look professional.

maniac
Автор

Thanks Keith, I learned a lot in this one. I started learning programming with Java in college, but I am finding Python much more fun to work with. I've finally got that motivation back for programming.

patrickmbarker
Автор

I realise this is literally a year after you posted it but it is still the best source I've found for learning how to use Tkinter. Thanks :)

Phoenix-tono
Автор

If you have problems loading the pic on a mac, try importing: from pathlib import Path
then define the image path: image = Path('*your folder1*/*your folder2*/*your folder3*/*your_pic.png*')
After that just add file=image: background_image = tk.PhotoImage(file=image)

Thanks for the vid, Keith!

maximilianschmid
Автор

I had a hard time reading the "official" documentation as I guess it's not really well-maintained and updated. Following your video is such an efficient and effective way to kick start my Tkinter learning. Good job brother!

AlbertLeng
Автор

youcould change the title from tk to weather app with root.title('Wheather App') :D

theheadpriest
Автор

This i can guarantee is the fastest and clearest way to learn the basics of interactive GUI python programming and API calls. Beautifully done tutorial! Many thanks, God Bless.

VarunSridharan
Автор

Best tk tutorial out there! Thankyou. I was struggling with overcomplicated official docs.

baksagimm