forked from MohamedBouarada/WeChat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.py
88 lines (70 loc) · 2.27 KB
/
home.py
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
87
88
from tkinter import *
import colors
from PIL import ImageTk, Image
class HomePage:
def __init__(self, root=None):
self.root = root
def signupPage(self):
self.root.withdraw()
from signup import Signup
login = Signup(base=self.root)
login.main()
def loginPage(self):
self.root.withdraw()
from login import LoginPage
login = LoginPage(base=self.root)
login.main()
# main frame
def main(self):
self.root = Tk()
self.canvas = Canvas(self.root, width=700, height=400)
self.canvas.pack()
IMAGE_PATH = "./assets/bg2.jpg"
self.img = ImageTk.PhotoImage(
Image.open(IMAGE_PATH).resize((700, 400), Image.ANTIALIAS)
)
self.canvas.background = self.img
self.bg = self.canvas.create_image(0, 0, anchor=NW, image=self.img)
# Page Title
label_0 = Label(self.root, text="WeChat", width=40, font=("bold", 30))
label_0.place(relx=0.5, y=20, anchor=CENTER)
label_0.config(bg=colors.blue_light, fg=colors.blue_dark)
# Submit button
btnlogin = Button(
self.root,
text="SignUp",
width=15,
bg=colors.blue_dark,
fg=colors.blue_dark,
command=self.signupPage,
)
btnlogin.place(relx=0.7, y=170, anchor=CENTER)
btnlogin.bind("<Return>", self.signupPage)
btnlogin.config(
bg=colors.blue_dark,
fg="#FFFFFF",
activebackground=colors.blue_light,
activeforeground=colors.blue_dark,
)
# Submit button
btnlogin = Button(
self.root,
text="Login",
width=15,
bg=colors.blue_dark,
fg=colors.blue_dark,
command=self.loginPage,
)
btnlogin.place(relx=0.7, y=220, anchor=CENTER)
btnlogin.bind("<Return>", self.loginPage)
btnlogin.config(
bg=colors.blue_dark,
fg="#FFFFFF",
activebackground=colors.blue_light,
activeforeground=colors.blue_dark,
)
# it is use for display the registration form on the window
self.root.resizable(0, 0)
self.root.mainloop()
s = HomePage()
s.main()