How do I get the fractions of the visible part of a canvas?

Fredrik Lundh fredrik at pythonware.com
Wed Jul 2 05:55:11 EDT 2003


Mickel Grönroos wrote:

> I would like to be able to ask the canvas something like:
>
> t = canvas.visiblebox()
>
> and it would return a two-tuple of two-tuples with coordinates (of the
> a and b points in the picture above), say:
>
> t = ((10,10), (90,30))
>
> Using these values I could calculate the fractions myself.
>
> Any ideas?

this might work:

t = (
    (w.canvasx(0), w.canvasy(0)),
    (w.canvasx(w.winfo_width()), w.canvasy(w.winfo_height()))
    )

</F>








More information about the Python-list mailing list