-
Notifications
You must be signed in to change notification settings - Fork 0
/
TUBESGana.py
137 lines (98 loc) · 3.92 KB
/
TUBESGana.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
from tkinter import *
from PIL import ImageTk, Image
import os
import csv
os.chdir(os.path.dirname(__file__))
backgroundColor = "#B28A60"
root = Tk(className = "Pembelian Tiket Bioskop")
root.geometry("1000x800+200+0")
root.configure(bg=backgroundColor)
root.resizable(False,False)
################
registUsername = 'a'
registPassword = 'b'
with open('unpw.csv', 'a', newline ='') as unpw:
writer = csv.DictWriter(unpw, fieldnames = ['username', 'password'])
writer.writerow({'username':registUsername, 'password':registPassword})
################
unList = []
pwList = []
with open('unpw.csv') as unpw:
reader = csv.reader(unpw)
for un, pw in reader:
unList.append(un)
pwList.append(pw)
def open_halamanFilm(before):
top = Toplevel()
return
def changeWindow(before, after):
pass
def signIn():
un = username.get()
pw = password.get()
for i in range(len(unList)):
if un == unList[i] and pw == pwList[i]:
print('accessed')
break
else:
invalidLabel = Label(frameInside, text = "Invalid username or password.", fg = 'red', bg = '#F0F0F0', border = 0).place(x=35, y=180)
# image python cnema
img = ImageTk.PhotoImage(Image.open("pythonCinema.png"))
labelImg = Label(root, image = img)
labelImg.place(relx = 0.5, anchor = 'n' )
# frame utama
frame1 = Frame(root, width=900, height = 500, bg = '#F0F0F0', highlightbackground = '#058689', highlightthickness= 3)
frame1.place(relx = 0.5, rely = 0.2, anchor = 'n')
frame1.grid_propagate(0)
# Dalam frame
# main image
cartoonImage = Image.open("pythonCartoon2.png")
resized_cartoonImage = cartoonImage.resize((400,300), Image.ANTIALIAS)
newCartoonImage = ImageTk.PhotoImage(resized_cartoonImage)
cartoonImg = Label(frame1, image = newCartoonImage)
cartoonImg.place(rely=0.5, relx = 0.04, anchor='w')
# frame inside frame1
frameInside = Frame(frame1, width=350, height = 350, bg = '#F0F0F0')
frameInside.place(x= 480, y = 70)
#####
###############################################################
heading = Label(frameInside, text = 'Sign In', fg = '#058689', bg = '#F0F0F0', font = ('Microsoft YaHei UI Light', 23, 'bold'))
heading.place(x=100, y = 5)
###############################################################
def on_enter(e):
name = username.get()
if len(name) == 0 or name == 'Username':
username.delete(0, 'end')
def on_leave(e):
name = username.get()
if name == '':
username.insert(0, 'Username')
username = Entry(frameInside, width = 25, fg='black', border =0, bg='#F0F0F0', font = ('Microsoft YaHei UI Light', 11))
username.place(x=30,y=80)
username.insert(0, 'Username')
username.bind('<FocusIn>', on_enter)
username.bind('<FocusOut>', on_leave)
Frame(frameInside, width=295, height=2, bg = 'black').place(x=25, y=107)
###############################################################
def on_enter(e):
pword = password.get()
password.config(show='*')
if pword == 'Password' or len(pword) == 0:
password.delete(0, 'end')
def on_leave(e):
name = password.get()
if name == '':
password.config(show='')
password.insert(0, 'Password')
password = Entry(frameInside, width = 25, fg='black', border =0, bg='#F0F0F0', font = ('Microsoft YaHei UI Light', 11))
password.place(x=30,y=150)
password.insert(0, 'Password')
password.bind('<FocusIn>', on_enter)
password.bind('<FocusOut>', on_leave)
Frame(frameInside, width=295, height=2, bg = 'black').place(x=25, y=177)
###########################################################################
Button(frameInside, width=39, pady=7, text = 'Sign In', bg= '#058689', fg= '#F0F0F0', border = 0, command = signIn).place(x=35,y=234)
Label(frameInside, fg = '#058689', bg = '#F0F0F0', text = 'Or', border = 0).place(x=165, y=280)
signUpButton = Button(frameInside, width=39, pady=7, text = 'Sign Up', bg= '#058689', fg= '#F0F0F0', border = 0).place(x=35,y=314)
# Window 2: sign up
root.mainloop()