Create GUI App with Tkinter and SQLite - Step by Step Python Tutorial for Beginners

preview_player
Показать описание
Today we will create a highly sophisticated Tkinter application, which is PERFECT for beginners and even intermediate Python developers!! 💻💻💻
In this tutorial, we will:
⭐ connect an SQLite database of recipes to our app.
⭐ create a BEAUTIFUL graphic user interface with Tkinter.
⭐ randomly shuffle recipes and display them on the app.
⭐ preprocess table records.
⭐ use CUSTOM FONTS with Tkinter (works with Windows only).

I will guide you step by step, explaining each command, the logic behind it and even different approaches we can take!
This tutorial is designed especially for folks who are comfortable with Python but struggle to apply it in practice. Additionally, complete Python beginners will get all the instructions they need to keep up the phase! 😀

🛑🛑 Convert This App into a Professional Software 🛑🛑
-----------------------------------------------------------------------------------------------------------
Tutorial is now available (including a relational database fix!!!):
-----------------------------------------------------------------------------------------------------------

Download Starter Files (and Complete Project Files):

Install dependencies (Anaconda):
🐍 conda install -c anaconda tk
🐍 conda install -c anaconda pillow
🐍 conda install -c anaconda numpy
🐍 conda install -c conda-forge pyglet

Install dependencies (Pip):
🐍 pip install tkinter
🐍 pip install pillow
🐍 pip install numpy
🐍 pip install pyglet

----------------------------------------------------------
📽️ Other Related Tutorials of Mine 📽️
----------------------------------------------------------
⭐ Install Python with Anaconda:
⭐ SQLite Basics:
⭐ Web Scrape Databases with SQLite and Mechanical Soup:
⭐ Create simple GUI app with Tkinter:
⭐ Create advanced GUI app with Tkinter:

----------------------------------------------------------
⏰TIME STAMPS ⏰
----------------------------------------------------------
00:00 - intro
00:25 - starter files and wireframe
01:09 - create empty Tkinter window
01:33 - run Tkinter app
02:43 - set window title
02:58 - center window on the screen (Eval method)
04:00 - create Frame widget with custom width, height and background
05:32 - center window with Geometry method (alternative approach)
06:58 - create image widget
10:03 - center widgets in frame with pack propagate
11:01 - create Label widget
11:49 - fonts in Tkinter
13:20 - create Button widget
13:56 - change cursor to pointing hand
14:47 - button callback and why lambda is important
16:21 - add padding around widgets
17:05 - code refactoring
20:08 - connect SQLite database file
22:01 - database architecture walkthrough
23:54 - select all table names of a database with SQL
25:18 - fetch random database tables with SQL and NumPy
26:25 - fetch table records
27:56 - preprocess table name and records
30:09 - conditional list comprehension
34:45 - switch between frames
38:31 - remove widgets from frame
40:43 - sticky (remove white corners)
41:45 - label background in full window width
42:41 - use CUSTOM FONTS in Tkinter
43:24 - Pyglet
45:23 - Thanks for watching! :)

-------------------------------------------
🤝 Connect with me 🤝
-------------------------------------------
🔗 Github:
🔗 Discord:
🔗 LinkedIn:
🔗 Twitter:
🔗 Blog:

-------------------------------------------
💳 Credits 💳
-------------------------------------------
⭐ Database web scraped from:
⭐Switch between frames on StackOverflow:
⭐ Beautiful icons:
Рекомендации по теме
Комментарии
Автор

You are very sympathic and you have a talent for clear explanations, ,
but i think it would be better to teach sql from the beginning like it is meant to be.
Sql is an relational database what means you would structure that case differently:
Only two table are needed: The first table (name: Recipies) holds an id and name (recipiename) column. The second table (name Ingridients) holds following columns: another id, Recipies_Fk (foreign key, pointer to the id column of the first tabel) and then all the ingridient fields. Thats it. Now the table name of your sql statements are static. But you need now more sql statments: "Select * from Recipies" select a random line in the pyhton code and pass the id to the follwoing statement "Select * from Ingriedients where Recipies_Fk = <An Id of your Recipie Table>;".

You also gain there big advantage which is that you are only loading the neccessary ingridients.

justiccoolman
Автор

This lady is a fantastic teacher and dedicated to her work. At one point she is savagely attacked by what appears to be wild cats and she carries on with the class....

bluesparrow
Автор

Tkinter GUI + Database = Exactly what I was looking for !!! Thank you ❤️

nemeziz_prime
Автор

At 14:49 you could also just remove the parenthesis on the function. When you assign the function with parenthesis you assign the functions return value, which in this case is None as it doesn't return anything, and the function is executed at assignment. Lambda is mostly useful when you need a non-default sorting key, or when you are only changing one argument.

Say for example, you inject a function into a class. You have a function triangle_area(bottom_side: float, angles: Tuple[float, float, float) -> float. But in your class the angles are always 60 degrees and it only takes a function -> float, so instead of making a brand new function, you pass it a lambda function Lambda x: triangle_area(x, (60, 60, 60)).

yeetdeets
Автор

I just been thinking about how to use tkinter. Thank you yt algorithms, and thank you too python simplified! :D

johnnyhicks
Автор

Finally, someone talks like a real person, instead of with those "programmer voice" like in most online tutorials.

danielx
Автор

Exactly what I wanted! The doc said I need to log my blood pressure daily and I want to create a simple gui that I can input the values and a button to update a database, and also show a plot for the values and stuff. This video will be very useful!

astropgn
Автор

Thank you for this hudge complet and easy TkInter tuto. Very clear.

Maybe my libs are a "little" to old, but :
- from PIL import ImageTk raised a import exception. So, i use logo_img = and it works.
- SQL command "SELECT * FROM sqlite_schema WHERE type='table';" didn't work, So, i use "SELECT * FROM sqlite_master WHERE type='table';"

If it could be usefull to someone ...

Put root.eval("tk::PlaceWindow . center") just after load_frame1() seems to be nice too ;)

eizou.inkomika
Автор

I keep saying CORSORE to my friends out of context. You have changed the word forever for me.

ForTheForsaken
Автор

Very happy to see a woman explaining python stuff, thank you.

kittel-dev
Автор

You’re such a fantastic teacher. You make it easy to understand. You should make a full python course. I’d love that

cryptombt
Автор

Thank you for this, I followed it all the way through, typing in the code myself and learnt loads. This is just the right kind of pace for me 👍

paulmoss
Автор

What a lovely girl! and a great teacher! I wish I had a teacher like this 10 years ago. Clear explanations! Charming! and reads your mind.

When you say: why are

She says: and if you are thinking about this: here is the answer hahahaha. amazing! Keep Rocking!

ibisboutto
Автор

I'm simultaneously thrilled and furious to learn how easy it is to center the app on the screen with just that root.eval("tk::PlaceWindow . center") method. I've gone to extensive lengths before for worse-looking behavior.

This is an incredible tutorial and I learned a lot, thank you for this

idrios
Автор

I just started learning Python and I was lucky to come across you videos which made me not only fall in love with you and your way of explaining complex concepts with simple words but fall in love with Python... It's a pleasur to whatch and hear you teach.

gencxhiha
Автор

I'm used to learn new Python things from Indian Developers, which I hardly understand, so it's very refreshing to see and listen to you. Also the Cat accident is very relatable, since my cat alwys do such things

danielschwan
Автор

I had an issue fetching the database at 25:17 using cursor.execute("SELECT * FROM sqlite_schema WHERE got it working using cursor.execute("SELECT * FROM sqlite_master WHERE type='table';")

Great job by the way :)

RojaySuccessful
Автор

I ABSOLUTLY LOVED this Video, it was super clear and you made eveything look so simple and easy
Thank you so MUCH for the effort u put into into, Keeping the code zoomed in was the best thing, it helped A LOT
Please keep the same video style and im highly looking forward to the next video.
i was honestly feeling down recently because i could not understand some tutorials, but your video really boosted me and my confidence to keep learning. Take Care Maryia💗

alanprado
Автор

I got 9 minutes in, and every minute was clear, practical, and perfectly explained. Subscribed! I will continue watching on weekend when I have more time. You have an excellent teaching style.

VanguardOnline
Автор

Wow Maria! That was beautifully done. Nice and clear, explained well and easy to follow. I will be watching a lot more of your videos. Thanks!!

robertcarroll