File: class/Workbook/Examples/Lecture11/hellouse.py

#!/usr/local/bin/python
from hello   import Hello             # get class to attach
from Tkinter import *                 # get Tkinter widgets

class HelloContainer(Frame):          # has-a hello.Hello
    def __init__(self, parent=None):
        Frame.__init__(self, parent)
        self.pack()
        self.make_widgets()

    def make_widgets(self):
        mine = Button(self, text='Attach',
                            command=self.quit)
        mine.pack(side=LEFT)
        Hello(self)                   # attach a Hello to me

if __name__ == '__main__': HelloContainer().mainloop() 



[Home page] Books Code Blog Python Author Train Find ©M.Lutz