-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathmain.pyw
72 lines (56 loc) · 2.03 KB
/
main.pyw
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
import ast
import tkvideo
import os
from tkinter import *
from tkinter import messagebox
from Python.signupwindow import sign_up
display= Tk()
display.title("Login")
display.geometry('1080x620+300+200')
display.configure(bg="black")
display.resizable(False,False)
my_label = Label(display)
my_label.pack()
player = tkvideo.tkvideo("Media\\signin.mp4", my_label, loop = 0, size = (1080,620))
player.play()
###########################################################################################################
###########################################################################################################
def signin():
username=user.get()
password=code.get()
file=open('User_data\\datasheet.txt','r')
d=file.read()
r=ast.literal_eval(d)
file.close()
if username in r.keys() and password==r[username]:
display.destroy()
os.startfile('Python\\gamewindow.pyw')
else:
messagebox.showerror('invalid','Invalid username or password')
#########################################################################################################################################
def on_enter(e):
user.delete(0, 'end')
def on_leave(e):
name=user.get()
if name=='':
user.insert(0,'username')
user=Entry(display,width=30,fg='#f41d94',font=('Microsoft YaHei UI Light',11))
user.place(x=765,y=240)
user.insert(0,'username')
user.bind('<FocusIn>',on_enter)
user.bind('<FocusOut>',on_leave)
def on_enter(e):
code.delete(0,'end')
def on_leave(e):
name=code.get()
if name=='':
code.insert(0,'password')
code=Entry(display,width=30,fg='#f41d94',font=('Microsoft YaHei UI Light',11))
code.place(x=765,y=320)
code.insert(0,'password')
code.bind('<FocusIn>',on_enter)
code.bind('<FocusOut>',on_leave)
Button(display,width=35,pady=5,text='sign in',bg='#f41d94',fg='white',border=0,command=signin).place(x=765,y=400)
sign_up= Button(display,width=6,text='sign up',border=0,bg='#f41d94',fg='white',cursor="hand2",command=sign_up)
sign_up.place(x=965,y=466)
display.mainloop()