body {
font-family: Arial, sans-serif;
margin: 20px;
padding: 20px;
background-color: #f4f4f4;
}
h1 {
color: #333;
text-align: center;
}
p {
line-height: 1.6;
color: #555;
}
.code {
background-color: #f9f9f9;
padding: 10px;
border-radius: 5px;
}
Modern GUI with Python – Tkinter Modern Desktop App [For Beginners]
Are you a beginner in Python programming and want to develop a modern desktop application with a graphical user interface (GUI)? Tkinter, the standard GUI toolkit for Python, is here to help you achieve that goal with ease. In this article, we will guide you through the process of creating a modern desktop app using Tkinter.
Getting Started with Tkinter
Tkinter comes pre-installed with Python, so you don’t need to install it separately. You can start by creating a new Python script and importing the Tkinter module:
import tkinter as tk
Creating a Modern GUI
Tkinter provides a wide range of widgets and styling options to create a modern-looking GUI. You can use various widgets such as buttons, labels, entry fields, and more to design your application’s interface. Furthermore, you can customize the appearance of these widgets using colors, fonts, and other styling properties.
Here’s an example of creating a simple modern-looking button in Tkinter:
button = tk.Button(root, text="Click Me", bg="#3498db", fg="white", font=("Arial", 12))
button.pack()
Building a Functional Application
Once you have designed the GUI, you can add functionality to your application by defining event handlers and connecting them to the appropriate widgets. For example, you can create a function to handle the button click event and perform a specific action when the button is clicked:
def on_button_click():
# Perform a specific action
pass
button = tk.Button(root, text="Click Me", command=on_button_click)
Conclusion
With Tkinter, creating a modern desktop app with a GUI in Python is straightforward, even for beginners. By leveraging the features and customization options provided by Tkinter, you can develop visually appealing and functional applications for a modern desktop environment. So, go ahead and start building your first modern desktop app with Tkinter!
Thank you for a brilliant tutorial, love your work. However mine did not turn to dark mode. Interested in deleting todo task or tick boxing it. 😀
Hi Hala (or anyone). Great tutorial. I am new to this. I've been struggling trying to figure out how to clear or reset the screen (scrollable frame). Any suggestions? Thanks.
Figured this out. I moved the entry field above the scrollable frame and then destroyed the widgets on the scrollable frame from a command in a 'clear entries' button I placed at the bottom of the screen. If there is a better way to do this, please let me know. Thanks.
thank you Hala 🙂
need to update for python 3.12. customtkinter seems to be missing things on the newer python
Awesome
my dark mode doesn't work 🙁
Tack så mycket. Tydligt och mycket användbart. Lycka till.
Thanks so much. Clear and very useful. Good luck.
This video really impressed me. The way that you're able to demonstrate tkinter while also clearly explaining what each line of code does is so valuable!! Keep it up
Hi I am building the same app from scratch but i'm stuck on delete future how i can implement this
I installed customtkinter and everything worked fine but as soon as I try to use the directory "import customtkinter" I receive an error message by VS Code like "module doesn't exist". Do you have any clues on how to solve the problem? Thanks
Your explanations always extremely clear and to the point 👏👏
thank you Hala it is a great work , if you don't mind how can I make add work with the enter button from keyboard
extremely good and well explained tutorial. thank you so much
helped me a lot with understanding how to lay out elements
thanks for the detailed video . hoping for more of these in upcoming time
Brilliant as usual , I have an issue It is Light not dark even when I imported sv_ttk library .. is there any solution for that??
alternative for frame class from basic tkinter? I'd like to update a script that used tkinter
Please create a series of CustomTkinter videos for the most common widgets 🙏
Hello Hana, thanks for such a nice video. I want to create a button that cleans the scrollable_frame. Could you help us with that? Thanks a lot.
3:10 I have watched 4 or 5 videos on tkinter and you are the first one to say this! EXCELLENT Explanations! ❤❤❤
nice