Tkinter canvas size determination
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter canvas size determination
Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Dean Allen Provins <[EMAIL PROTECTED]> 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 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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter canvas size determination
Cameron: Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Dean Allen Provins <[EMAIL PROTECTED]> 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 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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter canvas size determination
Martin: Martin Franklin wrote: > Dean Allen Provins wrote: > >> Cameron: >> >> Cameron Laird wrote: >> >>> In article <[EMAIL PROTECTED]>, >>> Dean Allen Provins <[EMAIL PROTECTED]> 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 >> 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 -- http://mail.python.org/mailman/listinfo/python-list
printing under MS win
Hi: My Linux-based Python/Tkinter application runs nicely, and printing works just fine (to a user-selected file, or an "lpr" device specified in the Entry box). Alas, the user wants to run it under MS Win, and of course will want to print the canvas for posterity. A Google search turned up a similar request from many years ago, which seemed to go unanswered. My current thoughts are 1) get the user to print to a file and let him copy the file to his printer (which is postscript); 2) do much the same as (1), but let the user display and print under Ghostscript/Ghostview; and 3) get the user to install UNIX printing services (which I found not to be trivial when I had to do it once) and then printing will run much as it does on UNIX/Linux. Any thoughts or other ideas? Regards, Dean Calgary -- http://mail.python.org/mailman/listinfo/python-list
Re: printing under MS win
Tim Golden wrote: > [Dean Allen Provins] > > | My Linux-based Python/Tkinter application runs nicely, and printing > | works just fine (to a user-selected file, or an "lpr" device specified > | in the Entry box). Alas, the user wants to run it under MS > | Win, and of > | course will want to print the canvas for posterity. > | > | A Google search turned up a similar request from many years ago, which > | seemed to go unanswered. > > Well, you don't really say what kind of data you wanted to > print, but maybe this page might spark a few ideas: > > http://timgolden.me.uk/python/win32_how_do_i/print.html > > TJG I'm printing PostScript (the default from a canvas). It looks like your URL pointer will answer the question quite adequately, as all the printers here are PS. Thanks. Dean -- http://mail.python.org/mailman/listinfo/python-list