By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
 443,934 Members | 1,527 Online
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,934 IT Pros & Developers. It's quick & easy.

# Tkinter canvas size determination

 P: n/a I need to determine the size of a canvas while the process is running. Does anyone know of a technique that will let me do that? Thanks, Dean Feb 22 '06 #1
Share this Question
5 Replies

 P: n/a In article <43**************@rpcl.com>, Dean Allen Provins wrote:I need to determine the size of a canvas while the process is running.Does anyone know of a technique that will let me do that? Feb 22 '06 #2

 P: n/a Cameron Laird wrote: In article <43**************@rpcl.com>, Dean Allen Provins wrote:I need to determine the size of a canvas while the process is running.Does anyone know of a technique that will let me do that? . . . Does >>> import Tkinter >>> c = Tkinter.Canvas() >>> c.create_oval(13, 51, 80, 130) 1 >>> c.pack() >>> print c.cget("width") 284 help? There are actually several different notions of the size of a canvas. The example abovve should be a good starting point, though. There's also a mailing list specifically for Tkinter ; that might interest you. Your suggestion helps immensely. I missed it in Shipman's Tkinter reference. And thank you for the mail list reference. I'll pursue it. Regards, Dean Feb 22 '06 #3

 P: n/a Cameron: Cameron Laird wrote: In article <43**************@rpcl.com>, Dean Allen Provins wrote:I need to determine the size of a canvas while the process is running.Does anyone know of a technique that will let me do that? . . . Does >>> import Tkinter >>> c = Tkinter.Canvas() >>> c.create_oval(13, 51, 80, 130) 1 >>> c.pack() >>> print c.cget("width") 284 help? There are actually several different notions of the size of a canvas. The example abovve should be a good starting point, though. There's also a mailing list specifically for Tkinter ; that might interest you. I tried the "cget" function, and it returned the width that I had used when creating the canvas - even though the canvas was wider than that value at display time (and also after manually resizing the window). To your knowledge, is there a method to determine the current dimensions? Thanks, Dean Feb 24 '06 #4

 P: n/a Dean Allen Provins wrote: Cameron: Cameron Laird wrote: In article <43**************@rpcl.com>, Dean Allen Provins wrote: I need to determine the size of a canvas while the process is running. Does anyone know of a technique that will let me do that? . . . Does >>> import Tkinter >>> c = Tkinter.Canvas() >>> c.create_oval(13, 51, 80, 130) 1 >>> c.pack() >>> print c.cget("width") 284 help? There are actually several different notions of the size of a canvas. The example abovve should be a good starting point, though. There's also a mailing list specifically for Tkinter ; that might interest you. I tried the "cget" function, and it returned the width that I had used when creating the canvas - even though the canvas was wider than that value at display time (and also after manually resizing the window). To your knowledge, is there a method to determine the current dimensions? Thanks, Dean Dean, Look at the winfo_* methods of Tkinter widgets, I think the one you want is called winfo_reqheight / winfo_reqwidth or something very similar pydoc Tkinter.Canvas will sort that out Martin Feb 24 '06 #5

 P: n/a Martin: Martin Franklin wrote: Dean Allen Provins wrote: Cameron: Cameron Laird wrote: In article <43**************@rpcl.com>, Dean Allen Provins wrote: I need to determine the size of a canvas while the process is running. Does anyone know of a technique that will let me do that? . . . Does >>> import Tkinter >>> c = Tkinter.Canvas() >>> c.create_oval(13, 51, 80, 130) 1 >>> c.pack() >>> print c.cget("width") 284 help? There are actually several different notions of the size of a canvas. The example abovve should be a good starting point, though. There's also a mailing list specifically for Tkinter ; that might interest you. I tried the "cget" function, and it returned the width that I had used when creating the canvas - even though the canvas was wider than that value at display time (and also after manually resizing the window). To your knowledge, is there a method to determine the current dimensions? Thanks, Dean Dean, Look at the winfo_* methods of Tkinter widgets, I think the one you want is called winfo_reqheight / winfo_reqwidth or something very similar pydoc Tkinter.Canvas will sort that out Martin Thanks. That is exactly what I needed. I tried it, and it returned the desired values. Regards, Dean Feb 24 '06 #6

### This discussion thread is closed

Replies have been disabled for this discussion.