Create a Modern login UI using the CustomTkinter Module in Python9 Jan 2025 | 6 min read IntroductionIn this tutorial, we will discuss how to create a Modern login UI using the CustomTkinter module in Python. Contemporary pc packages are consumer-friendly. Consumer interaction is not limited to console-based totally I/O. They have a different ergonomic graphical person interface (GUI) way to excessive velocity processors and powerful graphics hardware. Those applications can get hold of inputs via mouse clicks and may permit the purchaser to pick out alternatives with the help of radio buttons, dropdown lists, and different GUI factors (or widgets). Such packages are advanced by considering one of the numerous pics libraries available. A photographs library is a software program toolkit having a set of lessons that outline the capability of various GUI elements. These pix libraries are usually written in C/C++. Many of them had been ported to Python as importable modules. Some of them are listed underneath: Tkinter is the Python port for the Tcl-Tk GUI toolkit superior via Fredrik Lundh. This module is bundled with elegant distributions of Python for all platforms. CustomTkinter is a module this is, in basic terms, built upon the Tkinter module, which enables the builders to create present-day UI, which became no longer feasible with the traditional Tkinter module. It helps various new, contemporary, and customizable widgets to install our UI. Tkinter and CustomTkinter can both be used collectively to construct UI. Which Module is needed?In this text, we want a CustomTkinter and Tkinter module to construct the login web page. We will install these modules by executing the below instructions in the terminal. The way to create a simple blank UI?To create a simple page first, import the CustomTkinter module, then use the set_appearance_mode() function to darken the appearance of this page and the set_default_color_theme() function to set a blue theme. After that, initialize the app and set the size and title. Program Code:Now we write code in python. Output: ![]() Now we compile the above application and run it. The title bar displays the specified title. In other words, a modern login UI using Customtkinter. It was like this because it was dark mode. Nothing has been added yet, so this topic needs to be reflected. Adding a widget later will take effect. Then the output is given below. Create the login function:Here, we write the login function. After getting into an appropriate username and password, a welcome or error message will be displayed. I did not use a database for this, so I used the predefined username and password. Program Code: Here, we write a code to create the login function in python. The code is given below - Here we first create a predefined username and password that can only be used for login. The new_window variable uses the CTkToplevel() method to create another window. This is similar to his Toplevel() method in classic Tkinter. As a parameter, pass the app variable that initialized the CustomTkinter. The new window's title and height, and width are also defined. Then use the get() method to check if the user is passing the correct username and password. The user_entry and user_pass variables will be used later in the code when creating these widgets. A different warning or error message is displayed for each type of error. Here we also use the traditional Tkinter module's messagebox method to display warning, error, and success messages. Create and add the widgets in python:Firstly, we are creating the label of the principle page (it is non-obligatory to present). Then creating the body to create the frame of our UI. Then create the label so one can be proven on the top of the widgets we can add. Then we are growing the access section in which the person will put the username and password; inside the password segment, we are passing the show parameter with "*" because while we enter the password simplest "***" may be shown. Then choosing the padding. Then the Login Button, passing the login function we created earlier, and finally, a checkbox for do not forget me, a consumer might also or might not offer this. Ultimately, we're going for walks with the app using the mainloop() method. Program Code:Here, we write code for creating and adding the widgets in python. The code is given below - Output: ![]() Program Code:Here, we write the complete code in python. The code is given below - Basic application of the UI:GUI factors and their capability are defined within the Tkinter module. The following code demonstrates the stairs to growing a UI. Explanation: First, import the TKinter module. After importing, call the Tk() function to set up the application object. This creates a bordered pinnacle-degree (root) window with a title bar, a manipulated field with reduce and close buttons, and a customer vicinity to hold other widgets. The geometry() approach determines the width, height, and coordinates of the upper left nook of the frame as shown beneath (all values are in pixels): window.geometry("widthxheight+XPOS+YPOS"). It loops by calling the mainloop() method. The application now continuously waits for any event generated by the inner element. An event can be text entered into a text field, a selection from a drop-down list or radio button, a single or double-click action, and so on. A function of an application may include executing an appropriate call back function in response to a specific type. Included. of the event. Event handling is discussed later in this tutorial. Click the close button inside the identify bar to exit the event loop. Conclusion:So, in this article, we are discussing how to create a Modern login UI using the CustomTkinter module in Python. CustomTkinter is a module this is, in basic terms, built upon the Tkinter module, which enables the builders to create present day UI, which became no longer feasible with the traditional Tkinter module. Contemporary pc packages are consumer-friendly. Consumer interaction is not limited to console-based totally I/O. They have a different ergonomic graphical person interface (GUI) way to excessive velocity processors and powerful graphics hardware. |
An Introduction to Atom Time waits for no one, and in order to stay up with this incredibly fast-paced world, we always need to update our tools. One of the main industries where programmers require the most creative surroundings to write code and create software quickly is...
8 min read
Moving averages are essential indicators when we need to find the trend of a stock or share for a specific period. Moving averages critically analyse the time series; thus, they are accommodating for economists, traders, and analysts to get insights about the market trend, identify the...
9 min read
A fully automated search engine, Google Scan employs software known as web crawlers to continuously search the internet for sites to add to our index. In reality, a sizable portion of the pages featured in our results aren't manually added; rather, they are discovered and added...
18 min read
Deep learning has proven to be a powerful tool in solving complex problems in various fields, such as image recognition, speech recognition, and natural language processing. However, traditional deep learning models such as Convolutional Neural Networks (CNNs) have some limitations. CNNs are good at detecting features,...
6 min read
In this article, we shall see how comprehension can be done in the data structures of Python like lists, dictionaries, set, and generators. Comprehension provides a precise way of writing a program in Python. It reduces the code size without affecting its easy readability. So, here we will...
3 min read
? One of the most well-liked and adaptable programming languages, Python may be used to create a variety of applications. Python gives programmers the ability to create server-side or backend code for web applications. Several frameworks and packages are also included. Considering this, we will attempt to...
3 min read
In this tutorial, we will learn how to implement the tqdm with the pandas library. The tqdm module is used to create the process bar as per the requirement. Process bars are valuable tools for estimating and displaying the time the task will take. To understand...
5 min read
Data Visualization is a crucial stage in Machine Learning. To fully comprehend the behavior and characteristics of your data, you must first visualize it. Python provides different libraries for data visualization. Turicreate is one of the best libraries provided by Python for Data Visualization. TuriCreate can be...
4 min read
Jupyter Notebook The Jupyter Notebook is an open-source web application that you can use to make and share records that contain live code, conditions, perceptions, and text. Jupyter Notebook is kept up with by individuals at Venture Jupyter. Jupyter Notebook are a side project from the IPython...
6 min read
Introduction In computer science, the Disjoint Set, commonly called the Union-Find data structure, is an effective tool for maintaining sets of objects and providing answers to queries regarding their connectedness. The Union-Find Algorithm in Python, frequently used to create the Disjoint Set, is incredibly effective at solving...
4 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India