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. Advertising

  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. Advertising

  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. 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. =?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:
    435
    =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=
    Jun 30, 2003
  2. =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=

    Re: Placing entry widgets on a canvas in Tkinter

    =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=, Jun 30, 2003, in forum: Python
    Replies:
    0
    Views:
    1,000
    =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=
    Jun 30, 2003
  3. Askari
    Replies:
    2
    Views:
    726
    Askari
    Aug 30, 2004
  4. PhilC
    Replies:
    2
    Views:
    909
    PhilC
    Oct 25, 2004
  5. Replies:
    10
    Views:
    278
    Rick Johnson
    Mar 15, 2013
Loading...

Share This Page