help building a chain-of-command (or maybe Object Oriented Recursion)

Nick Perkins nperkins7 at home.com
Sun May 27 15:00:28 EDT 2001


"Laura Creighton" <lac at cd.chalmers.se> wrote in message

> I want to use Decorators and to add functionality to basic Tkinter
> Widgets.  I want to be able to stack them in any arbitrary order, so I
> only have to write the have-scrolling-ability object once, and then
> both be able to scroll a text widget that has a yellow border (the
> border gets scrolled as well) and put a yellow border around a
> scrollable text widget (the border stays put and the text scrolls
> around inside it).  I also want to be able to add my decorators
dynamically.
> You can put a red border around a black border if you want to.

..sounds neat.  when you say a 'stack', do you mean a series of
'nested' tkinter widgets, each one containing the next?
if so, i wonder if there would be trouble trying to dynamically 're-parent'
widgets.  you might have to destroy and re-create widgets instead.



<snip>

> But there is a problem. The Scrollbar Widget and the other Widget
> that is going to be scrolled really need to know about each other.
> To connect a  scrollbar to a widget, you have to set the widget's
> (x or y)scrollcommand callbacks to the set method of the scrollbar, and
> set the scrollbar's command to the (x or y)view method of the widget.

the scrollbar only has to know about the scrollable widget if
there is some way, other than with the scrollbar, for the user
to scroll the widget.  if there is no other way to scroll, (eg arrow keys),
then you could leave out one half of that relationship.

>
> I don't think that this means that my design is fatally flawed.   But I
> don't know how the creational part of this idea is supposed to go.  If
> I could make one, I could use it all right but I don't know how to
> go about making one.  Has anybody done this?  Or can anybody tell
> right off that I can't do this, no matter how much I want to, and I have
> to start over again?
>

i'm sure it's not impossible.
sounds like an intersting idea.

(but the still a little fuzzy for me..
  could you give example of how you would use this?)
((and maybe give your def'n of 'decorators')?)






More information about the Python-list mailing list