tkinter canvas

G

Gigs_

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!
 
K

kyosohma

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
 
G

Gigs_

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
 
K

kyosohma

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top