• Home
  • Write for Us
  • Contact Us

CopyAssignment

We are Python language experts, a community to solve Python problems, we are a 1.2 Million community on Instagram, now here to help with our blogs.

×

Login System in Tkinter Python

 Ayush Purawr  January 27, 2021
Login System in Tkinter Python

In this tutorial, we are going to make a Login System in Tkinter Python. For this project, you need to have the Tkinter module.

This small project will contain features of login and signup systems as we saw in your daily life. Using this project, you will come to know a little information about how the login systems of all websites/applications work.

You can install Tkinter Module by writing the below command in your python terminal.

pip install tkinter

We also need to create a .txt file for saving the data of the users and validating the data entered by the user. Here I have made a file named Login.txt. You can give your name as per your choice.



Login System in Tkinter Python: Complete Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
from tkinter import *
import tkinter.messagebox as tsmg
root=Tk()
def check():
a=uname.get()
b=pwd.get()
c=cpwd.get()
mix=a+"-"+b+"-"+c
// Instead of Login.txt you should write your file name.
with open("Login.txt","r") as fi:
d=fi.readlines()
if b==c:
if str(mix) in str(d):
tsmg.showinfo("Welcome",f"Hello {a}, You Have SuccessFully Logged In")
else:
tsmg.showerror("Error","No User Found, Please Sign-Up First")
else:
tsmg.showerror("Error","Both Password Are Different")
uname.set("")
pwd.set("")
cpwd.set("")
def save():
a=uname.get()
b=pwd.get()
c=cpwd.get()
mix=a+"-"+b+"-"+c
if a!="" and b!="" and c!="" :
with open("Login.txt","r") as fi:
d=fi.readlines()
if str(mix) in str(d):
tsmg.showerror("Error","You Already Have An Account, Please Login")
uname.set("")
pwd.set("")
cpwd.set("")
elif str(a) in str(d):
tsmg.showerror("Error","Username Already Exist")
uname.set("")
pwd.set("")
cpwd.set("")
else:
if b==c:
with open("Login.txt","a") as f:
f.write(f"{a}-{b}-{c}\n")
tsmg.showinfo("Success","Your Account Has Been Created")
uname.set("")
pwd.set("")
cpwd.set("")
else:
tsmg.showerror("Error","Both Password Are Different")
uname.set("")
pwd.set("")
cpwd.set("")
uname=StringVar()
pwd=StringVar()
cpwd=StringVar()
root.geometry("700x500")
root.title("Welcome To My Page")
f=Frame(root)
Label(f,text="Login To Continue",font="SegoeUI 18 bold",pady=10).pack()
f.pack()
f=Frame(root)
Label(f,text="Username",font="SegoeUI 14 bold",pady=5).pack()
e1=Entry(f,textvariable=uname,font="SegoeUI 14 bold",borderwidth=5,relief=SUNKEN).pack(padx=5,pady=5)
Label(f,text="Password",font="SegoeUI 14 bold",pady=5).pack()
e2=Entry(f,textvariable=pwd,font="SegoeUI 14 bold",borderwidth=5,relief=SUNKEN).pack(padx=5,pady=5)
l1=Label(f,text="Conform-Password",font="SegoeUI 14 bold",pady=5).pack()
e3=Entry(f,textvariable=cpwd,font="SegoeUI 14 bold",borderwidth=5,relief=SUNKEN).pack(padx=5,pady=5)
f.pack()
f=Frame(root)
b1=Button(f,text="Login",font="SegoeUI 10 bold",command=check).pack(side=LEFT,pady=10,padx=10)
b2=Button(f,text="Sign-Up",font="SegoeUI 10 bold",command=save).pack(side=LEFT,pady=10,padx=10)
f.pack()
f=Frame(root)
Label(f,text="Don't Have An Account Then Sign-Up",font="SegoeUI 14 bold",pady=5).pack()
f.pack()
root.mainloop()
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Output:

Hope you liked this project.
Comment down your views/queries if you have.


Also Read:


  • Create your own ChatGPT with Python
    Create your own ChatGPT with Python
    ChatGPT is a product of openai, currently ChatGPT is the most famous product of openai but there are many other products. In this article, we will see how to use ChatGPT with Python means we create a program that can be used to simulate ChatGPT just like it does on https://chat.openai.com/chat/. So, we are really going…
  • SQLite CRUD Operations in Python
    SQLite | CRUD Operations in Python
    CRUD stands for Create Read Update Delete. I will show you how to perform CRUD Operations in Python. You need basic Tkinter and SQLite knowledge before you read further. This app is straightforward, when you will open this app, a GUI with 4 green colored buttons will open to perform CRUD(create read update delete) operations….
  • Event Management System Project in Python
    Event Management System Project in Python
    In this article, we will create Event Management System Project in Python with source code. Using this event management system, one can easily maintain ticket bookings for different events. This is a GUI project and we have created different files and modules to organize the different functions used in this system. Features of Event Management…
  • Ticket Booking and Management in Python
    Ticket Booking and Management in Python
    Hello friends, in this article we will build Ticket Booking and Management in Python. This app will simulate a general Ticket management system means this can be used for general ticket management just like a token. There will be 4 fields that will be used for managing tickets, 4 fields will be name(of person), ticket…
  • Hostel Management System Project in Python
    Hostel Management System Project in Python
    In this article, we will build a Hostel Management System Project in Python with Graphical User Interface and database integration. We will use the MongoDB database with pymongo module for managing data. This application can help hostel owners to make their work more convenient and Increase their Service Quality. This application can help users with…

Share:

Author: Ayush Purawr

Post navigation

← Complete Game In PyGame and Python
Desktop Battery Notifier using Python →

Search….

SiteMap

Python

Machine Learning

Pygame

Data Structures and Algorithms(Python)

Python Turtle

Games with Python

All Blogs On-Site

Python Compiler(Interpreter)

Online Java Editor

Online C++ Editor

Online C Editor

All Editors

Services(Freelancing)

Recent Posts

  • Struggling to Generate Ghibli-Style AI Images? Here’s the Real Working Tool That Others Won’t Tell You About!
  • ChatGPT vs DeepSeek: Who is the winner?
  • People are becoming AI Engineer with this free course in 2025: Here is how to join this…
  • Apply to Google’s Student Training in Engineering Program (STEP) Intern, 2025
  • Self-Driving Car Saves Falling Pedestrian, Showcases Promise of Autonomous Technology

© Copyright 2019-2024 www.copyassignment.com. All rights reserved. Developed by copyassignment