4
4
#;=============================================================
5
5
6
6
import tkinter as tk
7
- import time
8
7
9
8
9
+ class MainClass (tk .Tk ):
10
+ def __init__ (self ,* args ,** kwargs ):
10
11
11
- class FileUpload (tk .Tk ):
12
+ #Initialize the TK
13
+ tk .Tk .__init__ (self ,* args ,** kwargs )
12
14
13
- def __init__ (self ,root ,* args ,** kwargs ):
14
- root .geometry ('400x400' )
15
+ container = tk .Frame (self )
16
+ container .pack (side = "top" ,fill = "both" ,expand = True )
17
+ container .grid_rowconfigure (0 ,weight = 1 )
18
+ container .grid_columnconfigure (0 , weight = 1 )
15
19
20
+ self .frames = {}
16
21
17
- self .label1 = tk .Label (root ,text = "Upload Your profile picture:" ).pack (side = tk .TOP )
18
- self .button1 = tk .Button (root ,text = "Upload" ,width = 10 ,bg = "brown" ,fg = "white" ,command = self .upload_file )
19
- self .button1 .pack (pady = 35 )
20
- self .label2 = tk .Label (root ,text = "System Free" ,relief = tk .SUNKEN ,bd = 2 ,anchor = tk .W )
21
- self .label2 .pack (side = tk .BOTTOM , fill = tk .X ,padx = 2 )
22
22
23
+ for F in (PageHome ,PageProfile ,PageTimeline ,PageAbout ,PageLike ,PageSecurity ):
24
+ frame = F (container , self )
25
+ self .frames [F ] = frame
26
+ frame .grid (row = 0 , column = 0 , sticky = "news" )
23
27
28
+ self .show_frame (PageHome )
24
29
25
- def upload_file (self ):
26
- self .button1 .configure (bg = "white" ,state = tk .DISABLED )
27
- self .button1 .update ()
28
- self .label2 .configure (text = "File Uplading ...." ,fg = "green" )
29
- self .label2 .update ()
30
- time .sleep (1.1 )
31
- self .label2 .configure (text = "Wait ...." ,fg = "brown" )
32
- self .label2 .update ()
33
- time .sleep (1.1 )
34
- self .status ()
30
+ def show_frame (self , cont ):
31
+ frame = self .frames [cont ]
32
+ frame .tkraise ()
35
33
36
34
37
- def status (self ):
38
- self .label2 .configure (text = "File Uploaded :)" ,fg = "green" )
39
- self .label2 .update ()
40
- time .sleep (0.5 )
41
- self .button1 .configure (bg = "brown" , state = tk .NORMAL )
42
- self .button1 .update ()
35
+ class PageHome (tk .Frame ):
36
+ def __init__ (self ,parent ,container ):
43
37
38
+ tk .Frame .__init__ (self ,parent )
39
+ label1 = tk .Label (self ,text = "Welcome \n Wish you have FUN! :) " )
40
+ label1 .pack (pady = 50 ,padx = 5 )
44
41
45
- root = tk .Tk ()
46
- file1 = FileUpload (root )
47
- root .mainloop ()
42
+ button1 = tk .Button (self , text = "Profile" , width = 10 , command =
43
+ lambda :container .show_frame (PageProfile ))
44
+ button1 .pack ()
45
+
46
+ button2 = tk .Button (self , text = "Timeline" , width = 10 , command =
47
+ lambda :container .show_frame (PageTimeline ))
48
+ button2 .pack ()
49
+
50
+ button3 = tk .Button (self , text = "Likes" , width = 10 , command =
51
+ lambda :container .show_frame (PageLike ))
52
+ button3 .pack ()
53
+
54
+ button4 = tk .Button (self , text = "Security" , width = 10 , command =
55
+ lambda :container .show_frame (PageSecurity ))
56
+ button4 .pack ()
57
+
58
+ button5 = tk .Button (self , text = "About" , width = 10 , command =
59
+ lambda :container .show_frame (PageAbout ))
60
+ button5 .pack ()
61
+
62
+
63
+ class PageProfile (tk .Frame ):
64
+
65
+ def __init__ (self ,parent ,container ):
66
+
67
+ tk .Frame .__init__ (self ,parent )
68
+ label1 = tk .Label (self , text = "Your Profile !!!!" )
69
+ label1 .pack (pady = 50 ,padx = 5 )
70
+
71
+ button1 = tk .Button (self , text = "Home" , width = 10 , command =
72
+ lambda :container .show_frame (PageHome ))
73
+ button1 .pack ()
74
+
75
+ button2 = tk .Button (self , text = "About" , width = 10 , command =
76
+ lambda :container .show_frame (PageAbout ))
77
+ button2 .pack ()
78
+
79
+ button3 = tk .Button (self , text = "Timeline" , width = 10 , command =
80
+ lambda :container .show_frame (PageTimeline ))
81
+ button3 .pack ()
82
+
83
+ button4 = tk .Button (self , text = "Likes" , width = 10 , command =
84
+ lambda :container .show_frame (PageLike ))
85
+ button4 .pack ()
86
+
87
+ button5 = tk .Button (self , text = "Security" , width = 10 , command =
88
+ lambda :container .show_frame (PageSecurity ))
89
+ button5 .pack ()
90
+
91
+
92
+
93
+ class PageAbout (tk .Frame ):
94
+
95
+ def __init__ (self ,parent ,container ):
96
+
97
+ tk .Frame .__init__ (self ,parent )
98
+ label1 = tk .Label (self , text = "About Yourself :) " )
99
+ label1 .pack (pady = 50 ,padx = 5 )
100
+
101
+ button1 = tk .Button (self , text = "Profile" , width = 10 , command =
102
+ lambda :container .show_frame (PageProfile ))
103
+ button1 .pack ()
104
+
105
+ button2 = tk .Button (self , text = "Home" , width = 10 , command =
106
+ lambda :container .show_frame (PageHome ))
107
+ button2 .pack ()
108
+
109
+ button3 = tk .Button (self , text = "Timeline" , width = 10 , command =
110
+ lambda :container .show_frame (PageTimeline ))
111
+ button3 .pack ()
112
+
113
+ button4 = tk .Button (self , text = "Likes" , width = 10 , command =
114
+ lambda :container .show_frame (PageLike ))
115
+ button4 .pack ()
116
+
117
+ button5 = tk .Button (self , text = "Security" , width = 10 , command =
118
+ lambda :container .show_frame (PageSecurity ))
119
+ button5 .pack ()
120
+
121
+
122
+ class PageTimeline (tk .Frame ):
123
+
124
+ def __init__ (self ,parent ,container ):
125
+
126
+ tk .Frame .__init__ (self ,parent )
127
+ label1 = tk .Label (self , text = "Your recent Posts : " )
128
+ label1 .pack (pady = 50 ,padx = 5 )
129
+
130
+ button1 = tk .Button (self , text = "Profile" , width = 10 , command =
131
+ lambda :container .show_frame (PageProfile ))
132
+ button1 .pack ()
133
+
134
+ button2 = tk .Button (self , text = "About" , width = 10 , command =
135
+ lambda :container .show_frame (PageAbout ))
136
+ button2 .pack ()
137
+
138
+ button3 = tk .Button (self , text = "Likes" , width = 10 , command =
139
+ lambda :container .show_frame (PageLike ))
140
+ button3 .pack ()
141
+
142
+ button4 = tk .Button (self , text = "Security" , width = 10 , command =
143
+ lambda :container .show_frame (PageSecurity ))
144
+ button4 .pack ()
145
+
146
+ button5 = tk .Button (self , text = "Home" , width = 10 , command =
147
+ lambda :container .show_frame (PageHome ))
148
+ button5 .pack ()
149
+
150
+
151
+ class PageLike (tk .Frame ):
152
+
153
+ def __init__ (self ,parent ,container ):
154
+
155
+ tk .Frame .__init__ (self ,parent )
156
+ label1 = tk .Label (self , text = "Things you have liked :) " )
157
+ label1 .pack (pady = 50 ,padx = 5 )
158
+
159
+ button1 = tk .Button (self , text = "Profile" , width = 10 , command =
160
+ lambda :container .show_frame (PageProfile ))
161
+ button1 .pack ()
162
+
163
+ button2 = tk .Button (self , text = "Timeline" , width = 10 , command =
164
+ lambda :container .show_frame (PageTimeline ))
165
+ button2 .pack ()
166
+
167
+ button3 = tk .Button (self , text = "About" , width = 10 , command =
168
+ lambda :container .show_frame (PageAbout ))
169
+ button3 .pack ()
170
+
171
+ button4 = tk .Button (self , text = "Security" , width = 10 , command =
172
+ lambda :container .show_frame (PageSecurity ))
173
+ button4 .pack ()
174
+
175
+ button5 = tk .Button (self , text = "Home" , width = 10 , command =
176
+ lambda :container .show_frame (PageHome ))
177
+ button5 .pack ()
178
+
179
+
180
+ class PageSecurity (tk .Frame ):
181
+
182
+ def __init__ (self ,parent ,container ):
183
+
184
+ tk .Frame .__init__ (self ,parent )
185
+ label1 = tk .Label (self , text = "Security Issues Here" )
186
+ label1 .pack (pady = 50 ,padx = 5 )
187
+
188
+ button1 = tk .Button (self , text = "Profile" , width = 10 , command =
189
+ lambda :container .show_frame (PageProfile ))
190
+ button1 .pack ()
191
+
192
+ button2 = tk .Button (self , text = "Timeline" , width = 10 , command =
193
+ lambda :container .show_frame (PageTimeline ))
194
+ button2 .pack ()
195
+
196
+ button3 = tk .Button (self , text = "Likes" , width = 10 , command =
197
+ lambda :container .show_frame (PageLike ))
198
+ button3 .pack ()
199
+
200
+ button4 = tk .Button (self , text = "About" , width = 10 , command =
201
+ lambda :container .show_frame (PageAbout ))
202
+ button4 .pack ()
203
+
204
+ button5 = tk .Button (self , text = "Home" , width = 10 , command =
205
+ lambda : container .show_frame (PageHome ))
206
+ button5 .pack ()
207
+
208
+
209
+ app = MainClass ()
210
+ app .mainloop ()
0 commit comments