How does Subclassing Work?
s713221 at student.gu.edu.au
s713221 at student.gu.edu.au
Wed Feb 21 16:59:33 EST 2001
Recently I tried to write a piece of code that subclassed Canvas.py from
the Tkinter distribution, where I overwrote CanvasItem. Now I was hoping
that all calls to Arc, Line etc. (which weren't overwritten) would call
my modified CanvasItem, but it seems they were calling the unmodified
CanvasItem - which isn't what I wanted.
What I wanted was:
My module ______> calls CanvasItem
|
Canvas.py Arc CanvasItem
What I got was:
My module CanvasItem
Canvas.py Arc _______> calls CanvasItem
Other than copy all of Canvas.py into my module and redefine everything,
is there a way I can get this to work as expected without rewriting
Canvas.py? What I was trying to do was alter Canvas so that I could
create classes that would make complex items.
Joal Heagney/AncientHart
More information about the Python-list
mailing list