You can get the attributes on any object/canvas item with the mapping
behaviour of the object.  So to get the text_width attribute, you can use:
  width = text_item['text_width']

You can also assign to attributes this way:
  text_item['x'] = 42
  container['border_width'] = 6 * 9

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Mon, 17 May 1999, J.W. Bizzaro wrote:

> Hello again.
> 
> I'm a bit boggled about how to get the properties or values of canvas items.  I
> put a text item on the canvas:
> 
>     canvas.root().add('text', x=10, y=10, font='Courier New',
> fill_color='black')
> 
> First of all, how do I tell the width of the resulting text, which is important
> for layout?  The barely-existing C-GNOME documentation hints at a text_width
> attribute.  I tried setting that, but I get a warning that it is not writable. 
> So maybe I can just "get" it like the other attributes, which brings up the
> second question.  How do I get the attributes I set?  I can't do any of the
> following:
> 
>     print canvas.root().text(text_width)
>     print canvas.root().text.text_width
>     print canvas.root().text_width
> 
> or even
> 
>     print canvas.root().text.get(text_width)
> 
> (C-GNOME has some "get" function, but I can't use it like this in PyGNOME)
> 
> I think my problem may be half not having C-GNOME documentation, half not
> understanding how C-GNOME is wrapped in Python, and half not knowing Python very
> well.
> 
> 
> :-)
> Jeff
> -- 
> J.W. Bizzaro                  mailto:[EMAIL PROTECTED]
> Boston College Chemistry      http://www.uml.edu/Dept/Chem/Bizzaro/
> --
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
> 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to