@@ -220,34 +220,33 @@ \subsubsection{A Simple Hello World Program} % HelloWorld.html
220220
221221
222222\begin {verbatim }
223- from Tkinter import * 1
224- 2
225- class Application(Frame): 3
226- def say_hi(self): 4
227- print "hi there, everyone!" 5
228- 6
229- def createWidgets(self): 7
230- self.QUIT = Button(self) 8
231- self.QUIT["text"] = "QUIT" 9
232- self.QUIT["fg"] = "red" 10
233- self.QUIT["command"] = self.quit 11
234- 12
235- self.QUIT.pack({"side": "left"}) 13
236- 14
237- self.hi_there = Button(self) 15
238- self.hi_there["text"] = "Hello", 16
239- self.hi_there["command"] = self.say_hi 17
240- 18
241- self.hi_there.pack({"side": "left"}) 19
242- 20
243- 21
244- def __init__(self, master=None): 22
245- Frame.__init__(self, master) 23
246- self.pack() 24
247- self.createWidgets() 25
248- 26
249- app = Application() 27
250- app.mainloop() 28
223+ from Tkinter import *
224+
225+ class Application(Frame):
226+ def say_hi(self):
227+ print "hi there, everyone!"
228+
229+ def createWidgets(self):
230+ self.QUIT = Button(self)
231+ self.QUIT["text"] = "QUIT"
232+ self.QUIT["fg"] = "red"
233+ self.QUIT["command"] = self.quit
234+
235+ self.QUIT.pack({"side": "left"})
236+
237+ self.hi_there = Button(self)
238+ self.hi_there["text"] = "Hello",
239+ self.hi_there["command"] = self.say_hi
240+
241+ self.hi_there.pack({"side": "left"})
242+
243+ def __init__(self, master=None):
244+ Frame.__init__(self, master)
245+ self.pack()
246+ self.createWidgets()
247+
248+ app = Application()
249+ app.mainloop()
251250\end {verbatim }
252251
253252
0 commit comments