I have created a login system using Python. There are 2 options login and register. We have to do registration for the login.
I have created a login system using Python. For this program, users have to install Python on their machine. It can run on any IDEs like pycharm, vs code, and command prompt also. User can install Python from https://www.Python.org/downloads/
For this program we have to import 2 libraries that are as follows:
1. from Tkinter import * - For creating GUI
2. import os- For working with files and directories
from Tkinter import *: Tkinter is the name of that library. This library is used for creating GUI. Tkinter provides a fast and easy way to create GUI applications. Tkinter provides a powerful object-oriented interface to the Tk GUI toolkit. Tkinter provides various controls, such as buttons, labels, and text boxes used in a GUI application. These controls are commonly called widgets. I have used labels, button widgets. For buttons, we have to give their geometrical size like text which has to be displayed on that button, width, and height. And command for the event happening after clicking that button.
import os: Python OS module provides the facility to establish the interaction between the user and the operating system. It offers many useful OS functions that are used to perform OS-based tasks and get related information about the operating system. The OS comes under Python's standard utility modules. This module offers a portable way of using operating system-dependent functionality. The Python OS module lets us work with the files and directories. I have used files and their functions like reading, write, close. I have use files for storing usernames and passwords for further verification.
There are 5 functions in the program. Their description is as follows:
1.def register_user(): This function is used for creating a new user. Here we have created 2 files for storing username and password.
2.def register(): This function is creating GUI for registration.
3.def login_verify(): This function is verifying login credentials. It is done by opening the files which have username and password. If it is matched then it will show success and if the password is wrong then it will show the wrong password. If both are invalid then it shows the user not found.
4.def login(): This is for creating a login GUI
5.def main_screen(): This function is for creating the main screen which has 2 buttons login and password.
Submitted by Ganesh Dinkarrao Kulkarni (ganeshk10)
Download packets of source code on Coders Packet