Re: saving a tkinter canvas

Discussion in 'Python' started by =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=, Apr 1, 2004.

  1. On Wed, 31 Mar 2004, Elaine Jackson wrote:

    > Newbie. Playing with the 'turtle' module and wondering if there's a way to save
    > the graphics you make with it. The documentation itself has nothing to say about
    > this, nor (as far as I can tell) does the FAQ list at python-dot-org. Any
    > pointers would be very much appreciated.


    You can save Tkinter.Canvases as PostScript using the
    Tkinter.Canvas.postscript() method.

    >>> import Tkinter
    >>> root = Tkinter.Tk()
    >>> canvas = Tkinter.Canvas(root)
    >>> canvas.pack()
    >>> rect = canvas.create_rectangle(10,10,100,100, fill="blue")
    >>> retval = canvas.postscript(file="saved.ps", height=100, width=100, colormode="color")
    >>>


    /Mickel

    --
    Mickel Grönroos, application specialist, linguistics, Research support, CSC
    PL 405 (Tekniikantie 15 a D), 02101 Espoo, Finland, phone +358-9-4572237
    CSC is the Finnish IT center for science, www.csc.fi
     
    =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=, Apr 1, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. biner

    saving a tkinter canvas to gif

    biner, Apr 14, 2004, in forum: Python
    Replies:
    2
    Views:
    2,191
    Reid Nichol
    Apr 16, 2004
  2. Reid Nichol

    Saving a Canvas as other than PS

    Reid Nichol, Apr 15, 2004, in forum: Python
    Replies:
    0
    Views:
    296
    Reid Nichol
    Apr 15, 2004
  3. Askari
    Replies:
    2
    Views:
    715
    Askari
    Aug 30, 2004
  4. PhilC
    Replies:
    2
    Views:
    896
    PhilC
    Oct 25, 2004
  5. Replies:
    10
    Views:
    267
    Rick Johnson
    Mar 15, 2013
Loading...

Share This Page