11from tkinter import *
22import datetime
3+
34date = datetime .datetime .now ().date ()
45date = str (date )
56
67class Application (object ):
7- def __init__ (self , master ):
8- self .master = master
9-
10- #frames
11- #
12- self .top = Frame (master , height = 150 , bg = 'white' )
13- self .top .pack (fill = X )
8+ def __init__ (self , master ):
9+ self .master = master
10+
11+ #frames
12+ #
13+ self .top = Frame (master , height = 150 , bg = 'white' )
14+ self .top .pack (fill = X )
15+
16+ self .bottom = Frame (master , height = 500 , bg = '#34baeb' )
17+ self .bottom .pack (fill = X )
18+
19+ #top frame design
20+ # self.top_image = PhotoImage(file='Icons/book.png')
21+ # self.top_image_label = Label(self.top, image=self.top_image)
22+ # self.top_image_label.place(x=120, y=10)
23+
24+ self .heading = Label (self .top , text = 'My Phonebook App' , font = 'arial 15 bold' , bg = 'white' , fg = '#ebb434' )
25+ self .heading .place (x = 230 , y = 50 )
1426
15- self .bottom = Frame ( master , height = 500 , bg = '#34baeb ' )
16- self .bottom . pack ( fill = X )
27+ self .date_lbl = Label ( self . top , text = "Today's date: " + date , font = 'arial 12 bold' , bg = 'white' , fg = '#ebb434 ' )
28+ self .date_lbl . place ( x = 450 , y = 110 )
1729
18- #top frame design
19- self .top_image = PhotoImage (file = 'Icons/book.png' )
20- self .top_image_label = Label (self .top , image = self .top_image )
21- self .top_image_label .place (x = 120 , y = 10 )
30+ class HomePage (Application ):
31+ def __init__ (self , parent , controller ):
32+ tk .Frame .__init__ (self , parent )
2233
23- self .heading = Label (self .top , text = 'My Phonebook App' ,font = 'arial 15 bold' , bg = 'white' , fg = '#ebb434' )
24-
25- self .heading .place (x = 230 , y = 50 )
2634
27- self .date_lbl = Label (self .top , text = "Today's date: " + date ,font = 'arial 12 bold' , bg = 'white' , fg = '#ebb434' )
28- self .date_lbl .place (x = 450 , y = 110 )
35+
36+
37+
38+ # # # Creates the Full Name Entry Box
39+ self .name = Label (self , text = 'Full Name:' )
40+ self .name .pack (pady = 2 , padx = 10 )
41+ self .name_box = Entry (self )
42+ self .name_box .pack ()
43+ self .name_box .focus_set ()
44+
45+ #
46+ # # Creates the Email Entry Box
47+ email = Label (self , text = 'Email:' )
48+ email .pack (pady = 2 , padx = 10 )
49+ email_box = tk .Entry (self )
50+ email_box .pack ()
51+ #
52+ # # Creates the Phone Number Entry Box
53+ phone = Label (self , text = 'Phone Number:' )
54+ phone .pack (pady = 2 , padx = 10 )
55+ phone_box = tk .Entry (self )
56+ phone_box .pack ()
2957
3058def main ():
31- root = Tk ()
32- app = Application (root )
33- root .title ("PhoneBook App" )
34- root .geometry ("650x550+350+200" )
35- root .resizable (False , False )
36- root .mainloop ()
59+ root = Tk ()
60+ app = Application (root )
61+ root .title ("PhoneBook App" )
62+ root .geometry ("650x550+350+200" )
63+ root .resizable (False , False )
64+ root .mainloop ()
65+
3766
3867if __name__ == '__main__' :
39- main ()
68+ main ()
0 commit comments