Login screen using tkinter python on android|How to create a working login screen using tkinter python|Python code to a working login screen using tkinter python| Login screen GUI





Introduction

In this Page we are going to learn how can we  create a working login screen using tkinter python.This code displays differently on different screen .To make it fit perfectly on your screen you can adjust the widths,geometery etc. 
To set Username and password by changing the comparison variables in line no.58 .which is displayed by RED COLOUR in this blog.
This code is specially designed for coding on android using applications like pydroid etc.

Watch the youtube tutorial attached to this blog at the end.

Source code:-

from tkinter import *
from tkinter import messagebox
root=Tk()

root.geometry("600x420")



#Labels



SPC1=Label(root,text="")

SPC1.grid(column=1,row=1)

Label1=Label(root,text=" USERNAME",

relief="ridge")

Label1.grid(column=1,row=2,padx=60)



SPC2=Label(root,text="")

SPC2.grid(column=1,row=3)

Label2=Label(root,text="Password",relief="ridge")

Label2.grid(column=1,row=4,padx=60)

#Entry WIDGETS

Entry1=Entry(root, width=17,justify=CENTER)

Entry1.grid(column=2,row=2)

Entry2=Entry(root,width=17,

justify=CENTER)

Entry2.grid(column=2,row=4)

#New window

def newwindow():
    newindow=Toplevel(root)
    newindow.geometry("600x420")
    newindow.title("Succeful login")
#Defining functions for Next button

def nextfunc():
#Getting input values

    Username=Entry1.get()
    Password=Entry2.get()
    if Username=="learntech" and Password=="subscribe":
        newwindow()
    else:
        messagebox.showwarning("Error","Wrong username or Password")
#QUIT & Next BUTTON

quit=Button(root,text="Quit",width=30,relief="raised",borderwidth=10,command=root.destroy)

quit.grid(column=1,row=8,columnspan=25)

next=Button(root,text="NEXT",width=30,relief="raised",borderwidth=10,command=nextfunc)

next.grid(column=1,row=7,columnspan=25)



SPC3=Label(root,text="")

SPC3.grid(column=1,row=5)

SPC4=Label(root,text="")

SPC4.grid(column=1,row=6)




root.mainloop()

#----------------------CODE ENDED----------------------

Output screen:-

 For Tutorial Watch My YouTube Video:-




"Hope you found it useful"
Have anything in mind? Let me 
know in the comment section👇
Next Post Previous Post
No Comment
Add Comment
comment url