tkinter canvas

Discussion in 'Python' started by Gigs_, Apr 18, 2007.

  1. Gigs_

    Gigs_ Guest

    how to write text on canvas. i know that i need to use canvas.create_text, but
    how to write text than when i create_text?
    or how to access object ID in canvas and change some options?


    thanks in advance!
     
    Gigs_, Apr 18, 2007
    #1
    1. Advertisements

  2. Gigs_

    Guest

    On Apr 18, 3:43 pm, Gigs_ <-com.hr> wrote:
    > how to write text on canvas. i know that i need to use canvas.create_text, but
    > how to write text than when i create_text?
    > or how to access object ID in canvas and change some options?
    >
    > thanks in advance!


    All you need to do is canvas.create_text(x, y, text='Hello World')
    where x and y are coordinates on the canvas. You can also add fg and/
    or bg to set foreground and background colors, respectively.

    Mike
     
    , Apr 18, 2007
    #2
    1. Advertisements

  3. Gigs_

    Gigs_ Guest

    wrote:
    > On Apr 18, 3:43 pm, Gigs_ <-com.hr> wrote:
    >> how to write text on canvas. i know that i need to use canvas.create_text, but
    >> how to write text than when i create_text?
    >> or how to access object ID in canvas and change some options?
    >>
    >> thanks in advance!

    >
    > All you need to do is canvas.create_text(x, y, text='Hello World')
    > where x and y are coordinates on the canvas. You can also add fg and/
    > or bg to set foreground and background colors, respectively.
    >
    > Mike
    >

    but is there any option to bind event?
    when i create text i want to write in text box on canvas so i think that i need
    to bind event
     
    Gigs_, Apr 19, 2007
    #3
  4. Gigs_

    Guest

    On Apr 19, 7:24 am, Gigs_ <-com.hr> wrote:
    > wrote:
    > > On Apr 18, 3:43 pm, Gigs_ <-com.hr> wrote:
    > >> how to write text on canvas. i know that i need to use canvas.create_text, but
    > >> how to write text than when i create_text?
    > >> or how to access object ID in canvas and change some options?

    >
    > >> thanks in advance!

    >
    > > All you need to do is canvas.create_text(x, y, text='Hello World')
    > > where x and y are coordinates on the canvas. You can also add fg and/
    > > or bg to set foreground and background colors, respectively.

    >
    > > Mike

    >
    > but is there any option to bind event?
    > when i create text i want to write in text box on canvas so i think that i need
    > to bind event


    I'm not sure what you mean. Do you want to type your text into a
    textbox and as you type, you want it displayed on the canvas itself as
    well? If that is the case, then yes, you'll need to bind an event. If
    you just want to type text in a textbox that is on a canvas, the
    textbox widget takes care of everything and binding an event is
    unnecessary.

    Here is some info on events:

    http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm
    http://www.builderau.com.au/program/print.htm?TYPE=story&AT=339272995-339024614t-320000000c
    http://www.bembry.org/technology/python/notes/tkinter_3.php

    Hope that points you in the right direction.

    Mike
     
    , Apr 19, 2007
    #4
    1. Advertisements

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. =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=

    Placing entry widgets on a canvas in Tkinter

    =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=, Jun 30, 2003, in forum: Python
    Replies:
    0
    Views:
    577
    =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=
    Jun 30, 2003
  2. Suresh  Kumar
    Replies:
    0
    Views:
    710
    Suresh Kumar
    Jul 4, 2003
  3. Gary Richardson

    Tkinter Canvas/Grid question

    Gary Richardson, Sep 11, 2003, in forum: Python
    Replies:
    6
    Views:
    3,723
    Jeff Epler
    Sep 12, 2003
  4. Marcel Achim

    tkinter canvas postscript fontmap

    Marcel Achim, Jan 13, 2004, in forum: Python
    Replies:
    1
    Views:
    1,474
    Richard Townsend
    Jan 13, 2004
  5. Peter Otten

    Hiding/showing Tkinter.Canvas items

    Peter Otten, Feb 17, 2004, in forum: Python
    Replies:
    2
    Views:
    448
    Peter Otten
    Feb 18, 2004
  6. Askari
    Replies:
    2
    Views:
    999
    Askari
    Aug 30, 2004
  7. PhilC
    Replies:
    2
    Views:
    1,125
    PhilC
    Oct 25, 2004
  8. Replies:
    10
    Views:
    552
    Rick Johnson
    Mar 15, 2013
Loading...