[Tutor] What does parent=0 mean?
Klas Marteleur
klas.martelleur at telia.com
Tue Aug 24 20:24:24 CEST 2004
Hi
I am going thru theGUI programing chapter in Alans latest web tutorial. And
found this example:
-----------------------------------------
from Tkinter import *
class ClearApp:
def __init__(self, parent=0):
self.mainWindow = Frame(parent)
# Create the entry widget
self.entry = Entry(self.mainWindow)
self.entry.insert(0,"Hello world")
self.entry.pack(fill=X)
# now add the 2 buttons, use a grooved effect
fButtons = Frame(fOuter, border=2, relief="groove")
bClear = Button(fButtons, text="Clear",
width=8, height=1, command=self.clearText)
bQuit = Button(fButtons, text="Quit",
width=8, height=1, command=self.mainWindow.quit)
bClear.pack(side="left", padx=15, pady=1)
bQuit.pack(side="right", padx=15, pady=1)
fButtons.pack(fill=X)
self.mainWindow.pack()
# set the title
self.mainWindow.master.title("Clear")
def clearText(self):
self.entry.delete(0,END)
app = ClearApp()
app.mainWindow.mainloop()
--------------------------------------------
What does parent=0 mean?
Klas
More information about the Tutor
mailing list