Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > tkinter canvas

Reply
Thread Tools

tkinter canvas

 
 
Gigs_
Guest
Posts: n/a
 
      04-18-2007
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!
 
Reply With Quote
 
 
 
 
kyosohma@gmail.com
Guest
Posts: n/a
 
      04-18-2007
On Apr 18, 3:43 pm, Gigs_ <g...@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

 
Reply With Quote
 
 
 
 
Gigs_
Guest
Posts: n/a
 
      04-19-2007
wrote:
> On Apr 18, 3:43 pm, Gigs_ <g...@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
 
Reply With Quote
 
kyosohma@gmail.com
Guest
Posts: n/a
 
      04-19-2007
On Apr 19, 7:24 am, Gigs_ <g...@hi.t-com.hr> wrote:
> kyoso...@gmail.com wrote:
> > On Apr 18, 3:43 pm, Gigs_ <g...@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/tkinte...d-bindings.htm
http://www.builderau.com.au/program/...14t-320000000c
http://www.bembry.org/technology/pyt.../tkinter_3.php

Hope that points you in the right direction.

Mike

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to couper contenier of a canvas in an outer canvas??? olsr.kamal@gmail.com Python 10 03-15-2013 08:46 PM
Canvas with scrollbars - how to get correct canvas coordinate when the scroll bars have moved? PhilC Python 2 10-25-2004 11:57 AM
Canvas scrolling - scrollBar become "disabled" on change in canvas Askari Python 2 08-30-2004 02:56 PM
Re: Placing entry widgets on a canvas in Tkinter =?ISO-8859-1?Q?Mickel_Gr=F6nroos?= Python 0 06-30-2003 01:02 PM
Placing entry widgets on a canvas in Tkinter =?ISO-8859-1?Q?Mickel_Gr=F6nroos?= Python 0 06-30-2003 12:34 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57