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 5 14852
In article <43**************@rpcl.com>,
Dean Allen Provins <dp******@rpcl.com> 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?
Cameron Laird wrote: In article <43**************@rpcl.com>, Dean Allen Provins <dp******@rpcl.com> 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 <URL: http://tkinter.unpythonic.net/wiki/mailing_20lists >; 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
Cameron:
Cameron Laird wrote: In article <43**************@rpcl.com>, Dean Allen Provins <dp******@rpcl.com> 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 <URL: http://tkinter.unpythonic.net/wiki/mailing_20lists >; 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 Allen Provins wrote: Cameron:
Cameron Laird wrote: In article <43**************@rpcl.com>, Dean Allen Provins <dp******@rpcl.com> 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 <URL: http://tkinter.unpythonic.net/wiki/mailing_20lists >; 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
Martin:
Martin Franklin wrote: Dean Allen Provins wrote:
Cameron:
Cameron Laird wrote:
In article <43**************@rpcl.com>, Dean Allen Provins <dp******@rpcl.com> 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 <URL: http://tkinter.unpythonic.net/wiki/mailing_20lists >; 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mickel Grönroos |
last post by:
Hi,
I'm trying to put an Tkinter.Entry of fixed size onto a specific location
on a canvas using the place manager. The idea is that one can double-click
a rectangle object on a canvas to get an...
|
by: John Velman |
last post by:
I want to draw a box around a short piece of text in canvas (one line
text). I know how to do it if I place the text on the canvas first,then
draw the box around it.
Is there a way to find out...
|
by: syed_saqib_ali |
last post by:
Please take a look at and run the code snippet shown below.
It creates a canvas with vertical & Horizontal scroll-bars.
If you shrink the window to smaller than the area of the canvas, the...
|
by: syed_saqib_ali |
last post by:
Below is a simple code snippet showing a Tkinter Window bearing a
canvas and 2 connected scrollbars (Vertical & Horizontal). Works fine.
When you shrink/resize the window the scrollbars adjust...
|
by: Stewart Midwinter |
last post by:
I have a Tkinter app running on cygwin. It includes a Test menu item
that does nothing more than fetch a directory listing and display it
in a Toplevel window (I'd use a tkMessageBox showinfo...
|
by: dmsbox2000-list1 |
last post by:
This is a beginner question. I am using a Mac running OS X. I have
TclTkAqua installed. If I type:
import Tkinter
r = Tkinter.Tk()
c = Tkinter.Canvas(r)
c.pack()
c.create_line(0,0,100,0)
|
by: Bob Greschke |
last post by:
I have a program that sucks in a list of equipment positions (Lats/Longs),
opens a Toplevel frame with a canvas set to, for example, 700x480 pixels,
and then does all of the calculations and plots...
|
by: joshdw4 |
last post by:
I hate to do this, but I've thoroughly exhausted google search. Yes,
it's that pesky root window and I have tried withdraw to no avail. I'm
assuming this is because of the methods I'm using. I...
|
by: akineko |
last post by:
Hello everyone,
I'm trying to create custom Tkinter/Pmw widgets for my project.
After testing my widgets under Unix (Solaris), I have tried them under
Windows and I got a surprise.
The...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |