Canvas geometry
Stephen D Evans
stevee at recombinant.demon.co.uk
Thu Jan 18 15:26:40 EST 2001
Have you tried the <configure> event ? The height and width of the canvas
are in the event properties. Here are some code fragments:
def configureEvent(event):
width = event.width
height = event.height
canvas.bind('<Configure>', configureEvent)
Stephen D. Evans
Hans Kristian Ruud wrote:
> Hello
>
> I try to retrieve the dimensions of a canvas in the following
> manner:
>
> h = eval( self.canvas.cget('height') )
> w = eval( self.canvas).cget('width') )
>
> however this does noe yield the true values (as I have
> demonstrated by this
> code):
>
> self.canvas.create_line(5,5,5,h-5,w-5,h-5,w-5,5,5,5,fill='red')
>
> The code in question is based upon the example draw3.py in
> Grayson's book
> Python and Tkinter programming (Chapter 10.2)
>
> How do I retrieve the "true" extensions of the canvas?
>
> På forhånd takk ( Thanks in advance )
>
> - hans kristian -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20010118/cdb035dd/attachment.html>
More information about the Python-list
mailing list