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

#!/usr/local/bin/python
from hello   import Hello            # get superclass
from Tkinter import *                # get Tkinter widgets

class HelloExtender(Hello):          # is-a hello.Hello
    def make_widgets(self):          # extend method
        Hello.make_widgets(self) 
        mine = Button(self, text='Extend',
                            command=self.quit)
        mine.pack(side=RIGHT)

    def onPress(self):
        print 'Greetings!'           # replace method

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



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