-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathUserProfile.py
More file actions
75 lines (57 loc) · 2.61 KB
/
UserProfile.py
File metadata and controls
75 lines (57 loc) · 2.61 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
from easygui import *
class UserProfile:
def __init__(self, fileName):
self.fileName = fileName #file name should be
def getFileName(self):
return self.fileName
def create(self, name, birthday, userName, password, address, \
email, therapist,tEmail, emContactName,emContactNumber):
profile = open(self.fileName, "w")
profile.write("Name: " + name + "\n")
profile.write("Birthday: " +birthday + "\n")
profile.write("Address: "+address+ "\n")
profile.write("User Name: " + userName+"\n")
profile.write("Password: " + password +"\n")
profile.write("Email: " + email +"\n")
profile.write("Emergency Contact Name: " + emContactName + "\n")
profile.write("Emergency Phone Number: " + emContactNumber + "\n")
profile.write("Therapist: " + therapist + "\n")
profile.write("Therapist email: " + tEmail +"\n")
profile.write("\n")
profile.close()
def Log(self, entry,date):
profile = open(self.fileName, "a")
profile.write(date + "\n")
profile.write(entry)
profile.write("\n")
profile.close()
def view(self):
profile= open(self.fileName, "r")
contents = profile.read()
print(contents)#Prints the content for viewing later
profile.close
def copy(self):
profile = open(self.fileName, "r")
copy = open("Copy.txt","w")
for line in profile:#used to make a copy of the file to prepare to send
copy.write(line)
profile.close()
copy.close()
def start():
choices = ["Create profile", "Log in"]
msg = "Welcome to Colorful!"
reply = buttonbox(msg,"Colorful",choices)
if(reply == "Create profile"):
msg = "Enter your personal information"
title = "User Profile"
fieldNames = ["name", "birthday", "userName", "password", "address","email", "Therapist","Therapist Email", "emContactName","EmContactNumber"]
fieldValues = [] # we start with blanks for the values
fieldValues = multenterbox(msg,title, fieldNames)
profile = UserProfile(fieldValues[0]+".txt")
profile.create(fieldValues[0],fieldValues[1],fieldValues[2],fieldValues[3],fieldValues[4],fieldValues[5],fieldValues[6],fieldValues[7],fieldValues[8],fieldValues[9])
message = ""
title = "How do you feel?"
output = textbox(message,title)
profile.log(output)
#Need to get the userprofile creation to work correctly.
start()