TkInter: Problem with propagation of resize events through geometry manager hierarchy?

curiouserrandy at gmail.com curiouserrandy at gmail.com
Sun Feb 8 10:08:11 EST 2009


On Feb 8, 6:27 am, James Stroud <jstr... at mbi.ucla.edu> wrote:

> I can't test your code because I don't have the test image and for some
> reason it does not recognize a tiff of my own. But, just glancing at
> your code, it looks like a quick-fix would be to set self.zoom to a
> sentinel at the end of refresh() and return 'break' at the top of the
> methods that use self.zoom if it is said sentinel value (e.g. "if
> self.zoom == WHATEVER_SENTINEL: return 'break'). You may also want to
> return 'break' for event responders that should terminate the event
> chain. This is a general technique to stop a lot of unwanted event
> propagation.

Thanks!  I hadn't known about the "return 'break'" technique.  But
I don't follow your sentinel suggestion; how would that sentinel
ever get reset?  It seems as if the first time through the event
chain it'd be set to the sentinel, and the routines that pay
attention to it would never execute.  What am I missing?
I tried simply returning 'break' at the end of "refresh()" and
that made no change in behavior.

(Note that zoom should be constant at 1.0 for the life of
this program; I put it in because I'm planning to put in expansion/
contraction of images after I get resize & scrolling working
together.  Eliminating all multiplications by self.zoom confirms
this belief; no change in behavior).

One thing I've been looking for (including in the source :-J) is
a description of the precise process that the geometry manager
goes through in figuring out and then setting sizes for the
various widgets (on resize or, apparently, startup).  I suspect
with that + the "return 'break'" technique I could get this to
work.  But I haven't been having any luck finding that documentation.

If you'd like me to send you the test.tiff image, I'm happy to, but
it's nothing special; just a screen capture of a random google maps
satellite view that I use for testing.

                             -- Randy


>
> James
>
> --
> James Stroud
> UCLA-DOE Institute for Genomics and Proteomics
> Box 951570
> Los Angeles, CA 90095
>
> http://www.jamesstroud.com




More information about the Python-list mailing list