Pedestrian Crossing Radar Management System


Main Formaning ko‘rinishi


Download 3.29 Mb.
bet24/27
Sana19.10.2023
Hajmi3.29 Mb.
#1709325
1   ...   19   20   21   22   23   24   25   26   27
Bog'liq
Pedestrian Crossing Radar Management System full - для слияния

Main Formaning ko‘rinishi

Login Formaga:
Label
TextBox
Button
Panel
ProgressBar
komponentalarini tashlaymiz.

Umumiy kod: LoginForm.py faylining kodlari:


from tkinter import*
from tkinter import ttk
from PIL import Image, ImageTk # pip install pillow
from tkinter import messagebox
import os
import subprocess

# ========= genearte hardware ================


# baseBoardID generate
baseboardID = subprocess.run(["powershell", "-Command", "wmic baseboard get SerialNumber"], capture_output = True)
resultB = baseboardID.stdout.decode("utf-8")
baseboardStr = str(resultB)
BaseboardID = baseboardStr[27:49]
#print(BaseboardID)

# processorID generate


processorID = subprocess.run(["powershell", "-Command", "wmic cpu get ProcessorID"], capture_output = True)
resultP = processorID.stdout.decode("utf-8")
processorStr = str(resultP)
ProcessorID = processorStr[21:37]
#print(ProcessorID)

bboardProc = str(BaseboardID + ProcessorID)


#print(bboardProc)

if bboardProc == 'NBQ3R11001914570A33400178BFBFF00810F10':


print("Open")
else:
print("No Open")
# ============================================
#from main import Face_Recognition_System

class Login_Window:


def __init__(self, root):
self.root = root
self.root.title("Login Window")
self.root.geometry("1200x700+0+0")
self.root.resizable(False, False)

# orqa fon


self.bg = ImageTk.PhotoImage(file=r"Images\background.png")
lbl_bg=Label(self.root, image=self.bg)
lbl_bg.place(x=0, y=0, relwidth=1, relheight=1)

# registratsiya formasi


frame = Frame(self.root, bg="black")
frame.place(x=430, y=120, width=340, height=450)

# avatar rasm


img1=Image.open(r"Images\avatar_icon.png")
img1=img1.resize((100,100),Image.ANTIALIAS)
self.photoimage1=ImageTk.PhotoImage(img1)
lblimg1=Label(image=self.photoimage1,bg="black",borderwidth=0)
lblimg1.place(x=550,y=75,width=100,height=100)

# sarlavha


get_str=Label(frame,text="Sign In",font=("times new roman",20,"bold"),fg="white",bg="black")
get_str.place(x=125,y=65)

# ---------Icon Images-----------


# cpu nomi label oldi rasmi


img0=Image.open(r"Images\img_avatar_kichik.png")
img0=img0.resize((25,25),Image.ANTIALIAS)
self.photoimage0=ImageTk.PhotoImage(img0)
lblimg0=Label(image=self.photoimage0,bg="black",borderwidth=0)
lblimg0.place(x=470,y=235,width=25,height=25)

# label cpu


cpuId=lbl=Label(frame,text="CPU Product ID",font=("times new roman",13,"bold"),fg="white",bg="black")
cpuId.place(x=70,y=115)

# edit1_cpu


self.cpu=ttk.Entry(frame,font=("times new roman",15,"bold"))
self.cpu.place(x=40,y=140,width=270)

# label cpu


cpu_lbl=lbl=Label(frame,text=f"{ProcessorID}",font=("times new roman",13,"bold"),fg="black",bg="white")
cpu_lbl.place(x=40,y=140)
# foydalanuvchi nomi label oldi rasmi
img2=Image.open(r"Images\img_avatar_kichik.png")
img2=img2.resize((25,25),Image.ANTIALIAS)
self.photoimage2=ImageTk.PhotoImage(img2)
lblimg2=Label(image=self.photoimage2,bg="black",borderwidth=0)
lblimg2.place(x=470,y=305,width=25,height=25)

# label user


userName=lbl=Label(frame,text="Username",font=("times new roman",13,"bold"),fg="white",bg="black")
userName.place(x=70,y=185)

# edit1_username


self.txtuser=ttk.Entry(frame,font=("times new roman",15,"bold"))
self.txtuser.place(x=40,y=210,width=270)

# parol label oldi rasmi


img3=Image.open(r"Images\lock_icon.png")
img3=img3.resize((25,25),Image.ANTIALIAS)
self.photoimage3=ImageTk.PhotoImage(img3)
lblimg3=Label(image=self.photoimage3,bg="black",borderwidth=0)
lblimg3.place(x=470,y=375,width=25,height=25)

# parol label


password=lbl=Label(frame,text="Password",font=("times new roman",13,"bold"),fg="white",bg="black")
password.place(x=70,y=255)

# edit2_parol


self.txtpass=ttk.Entry(frame,font=("times new roman",15,"bold"),show="*")
self.txtpass.place(x=40,y=280,width=270)

# kirish tugmachasi


loginbtn=Button(frame,text="Login",command=self.login,font=("times new roman",15,"bold"),cursor="hand2",bd=3,relief=RIDGE,fg="white",bg="green",activeforeground="yellow",activebackground="green")
loginbtn.place(x=110,y=330,width=120,height=35)

# registratsiya tugmachasi


registerbtn=Button(frame,text="New User Register",font=("times new roman",11,"bold"),cursor="hand2",bd=3,borderwidth=0,fg="#cecece",bg="black",activeforeground="yellow",activebackground="black")
registerbtn.place(x=5,y=380,width=200)

# forgetpassbtn


registerbtn=Button(frame,text="Forget Password!?",font=("times new roman",11,"bold"),cursor="hand2",bd=3,borderwidth=0,fg="#cecece",bg="black",activeforeground="yellow",activebackground="black")
registerbtn.place(x=5,y=410,width=197)

def login(self):


global ProcessorID
if self.txtuser.get()=="" or self.txtpass.get()=="":
messagebox.showerror("Error", "all field required")
elif (self.txtuser.get()=="reason" and self.txtpass.get()=="123" and ProcessorID=="178BFBFF00810F10"):
messagebox.showinfo("Succes", "Welcome to Project")
else:
messagebox.showerror("Invalid", "Invalid CPU Product ID, username & password")

## def Main_Page(self):


## self.new_window=Toplevel(self.root)
## self.app=Face_Recognition_System(self.new_window)
if __name__ == "__main__":
root = Tk()
app = Login_Window(root)
root.mainloop()



Download 3.29 Mb.

Do'stlaringiz bilan baham:
1   ...   19   20   21   22   23   24   25   26   27




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling