Text pixel width on tkinter canvas for Suresh who forgot subject ;-) [Was: Re: (no subject)]

Bengt Richter bokr at oz.net
Wed Jun 11 22:44:15 CEST 2003

On 11 Jun 2003 17:31:43 -0000, "Suresh  Kumar" <suresh_vsamy at rediffmail.com> wrote:

>   I am using python and tkinter. My question is a simple one. How 
>to find number of pixels that a text occupies in canvas? In 
>otherwords how can i get the width of the text whose width is not 
>set explicitly? I have placed a text, say "Hello World",  in the 
>canvas using "create_text" and want to find number pixels that it 
>The text is created as follows.
>          self.canvas.create_text(100,100, text="Hello World"))
>    The text starts at 100,100 and how to find the ending points 
>of the text?
>    I need the solution urgently. Please give your comments as 
>soon as possible.
I don't know off hand, but a subject line should help you get responses ;-)

Bengt Richter

More information about the Python-list mailing list