+ 2
I want to build a program(with GUI) coded in python...that will return the D.O.B of my church members when the day is their bir
date of birth GUI will have a button so that you can prompt it to return the birthday of a person that you inserted the name....and every particular day the program checks whose birthday coincides with the date and then return the persons name else will return the nearest birthday ahead ..( birthday coincision will be the default behavior of the program)
11 Antworten
+ 8
that's a cool idea! did you begin it already?
+ 8
@Akosa Prince Samuel, may you put it here or on code playground?
+ 8
@Akosa Prince Samuel, I can try :)
paste it on code playground and I'll take a look and try to help
+ 3
use tkinter to create gui in Python, compile and put it in start-up on your PC, done.
+ 1
yea. .but I need help
+ 1
yea I did but quite a little confused
+ 1
@LayB you can help write the code let's analyze it together
+ 1
ok
+ 1
@ LayB do go thru my profile and you will notice I have added two codes (age.py and person class) to this effect ....Please also go thru most of the comments especially the person class... to keep track with my reasoning....I do really need inputs. ..below is the age.py program
"""
Spyder Editor
This is a by Akosa Prince Samuel.
"""
# a program to calculate the age of someone
from datetime import *
def age():
bd=input(r'User should insert birth day in the format "YYYY-MM-DD": =')
try:
birthday=datetime.strptime(bd, '%Y-%m-%d')
today=datetime.today()
count=today.year-birthday.year
return('Age is approximately ' + str(count)+" " + 'years')
except ValueError:
while ValueError:
print(r'User should insert correct birth day in the format "YYYY-MM-DD": =' )
bd=input(r'User should insert birth day in the format "YYYY-MM-DD": =')
birthday=datetime.strptime(bd, '%Y-%m-%d')
today=datetime.today()
count=today.year-birthday.year
return('Age is approximately ' + str(count)+" " + 'years')
continue
else:
birthday=datetime.strptime(bd, '%Y-%m-%d')
today=datetime.today()
count=today.year-birthday.year
return('Age is approximately ' + str(count)+" " + 'years')
# to test the program
print(age())
+ 1
"""
@author: Akosa Prince Samuel
"""
# a partiall development of the class person in my church
class Person():
def __init__(self,name,age,marital_status,gender,dept):
self.name=name
self.age=age
self.marital_status=marital_status
self.dept=dept
self.gender=gender
def getgender(self):
if self.gender=='male':
return('Sex :', self.gender)
else:
return('Sex : ', self.gender)
def getname(self):
if self.gender=='male':
return('His name is : ',self.name)
elif self.gender=='female':
return('Her name is : ', self.name)
def getage(self):
if self.gender=='male':
return('He is: ' +str(self.age)+ ' old')
if self.gender=='female':
return ('She is: ' + str(self.age) + 'old')
def __str__(self):
if self.gender=='male':
return('Mr ' +str(self.name)+ ' who is ' +str(self.age) +' years old, is also ' +str(self.marital_status)+ ' and is in the ' + str(self.dept)+ ' department ' )
elif self.gender=='female':
if self.marital_status=='married':
return('Mrs ' +str(self.name)+ ' who is ' +str(self.age) +' years old, is also ' +str(self.marital_status)+ ' and is in the ' + str(self.dept)+ ' department ' )
elif self.marital_status=='single':
return('Miss ' +str(self.name)+ ' who is ' +str(self.age) +' years old, is also ' +str(self.marital_status)+ ' and is in the ' + str(self.dept)+ ' department ' )
# just a test for the programme above
f=Person('Gwen',15,'married','female','music')
print(f)
# this program is supposed to take values from the age program
#
+ 1
@layB
however this is what the output will be but I dont want the person class to be taking
# in arguments
# that you spelt outright, instead let the arguments be headings of some columns
# on an excel spreadsheet(in order words a database), so after matching, the program will then
# take those arguments internally and return the output like the above programs output. remeber
# I want it to be in GUI, so after working on the code we will add buttons and input areas so if
# you just type either a name or any other attributes like the arguments in the Person class
# the program matches them and returns the possible value(s). for further question drop a
# mail to me at samuel.akosa@outlook.com, using ubject of mail as SOLOLEARN.
# i need us to use GUI, excel 'openpxyl' command for excel files and any other technicality you can bring
# table