This project will validate your knowledge of the Python 102 topics.
You must build a GUI application to save a person's name in a file. The application should add a name, and display all names.
Create Two Files: main.py and names.txt.
-
Create class
Person- create object private variable
name - create a
get_namefunction to return thename - create a
set_namefunction to set thename - create a
write_filefunction to append a name to thenames.txtfile - create a class method
print_filefunction to print the filenames.txtcontent
- create object private variable
-
Create function
check_input()in the body do the following:- if
entis empty changemsgto display "Please enter a name" - else change
msgto display "Name added" - create an object called
obj1from the Person class and pass theent.get()as an argument - call
write_file()fromobj1 - print the
total
- if
-
Call
print_file()- before
tk.mainloop()call theprint_file()fromPersonclass
- before