- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcapstone.py
More file actions
Latest commit
95 lines (72 loc) · 2.59 KB
/
Copy pathcapstone.py
File metadata and controls
95 lines (72 loc) · 2.59 KB
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
# from adodbapi.examples.db_print import db
importadodbapi.ado_constsasadc
fromkivy.appimportApp
fromkivy.langimportBuilder
fromkivy.uix.screenmanagerimportScreenManager, Screen
fromkivy.propertiesimportObjectProperty
fromkivy.uix.popupimportPopup
fromkivy.uix.labelimportLabel
fromappimportsm, invalidForm
fromdatabaseimportDataBase
classCreateAccountWindow(Screen): #create an account window.
name=ObjectProperty(None)
email=ObjectProperty(None)
password=ObjectProperty(None)
defsubmit(self):
ifself.name.text!=""andself.email.text!=""andself.email.text.count("@") ==1andself.email.text.count(".") >0:
ifself.password!="":
db.add_user(self.email.text, self.password.text, self.name.text)
self.reset()
sm.current="login"
else:
invalidForm()
else:
invalidForm()
deflogin(self):
self.reset()
sm.current="login"
defreset(self):
self.email.text=""
self.password.text=""
self.namee.text=""
classLoginWindow(Screen): # create login window
email=ObjectProperty(None)
password=ObjectProperty(None)
defloginBotton(self):
ifdb.validate(self.email.text, self.password.text):
MainWindow.current=self.email.text
self.reset()
sm.current="main"
else:
invalidLogin()
defcreateBotton(self):
self.reset()
sm.current="create"
defreset(self):
self.email.text=""
self.password.text=""
classKivyApp(App):
defbuild(self):
self.title="Login Screen"
Window.size= (400, 200)
layout=GridLayout(cols=2, rows=2, padding=10, spacing=10, row_default_height=30)
usernameinput=TextInput()
print(usernameinput.text)
passwordinput=TextInput(password=True)
usernamelbl=Label(text="Username", size_hint_x=None, width=100)
passwordlbl=Label(text="Password", size_hint_x=None, width=100)
layout.add_widget(usernamelbl)
layout.add_widget(usernameinput)
layout.add_widget(passwordlbl)
layout.add_widget(passwordinput)
main_layout=BoxLayout(orientation='vertical', padding=10, spacing=10)
main_layout.add_widget(layout)
loginbutton=Button(text="Login")
main_layout.add_widget(loginbutton)
returnmain_layout
if__name__=='__main__':
print("Hello world!")
print(f"adc = {adc}")
# print(f"db = {db}")
app=KivyApp()
app.run()