tkinter canvas

kyosohma at gmail.com kyosohma at gmail.com
Thu Apr 19 11:18:44 EDT 2007


On Apr 19, 7:24 am, Gigs_ <g... at hi.t-com.hr> wrote:
> kyoso... at gmail.com wrote:
> > On Apr 18, 3:43 pm, Gigs_ <g... at hi.t-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




More information about the Python-list mailing list