The width of a Label.



Dear all,

After I change the text of a Label I would like to know what the width
of the Label is going to become. If I call the get_width() method it
only gives the right width if the text is changed is such a way that
the width does not change. If the width actually changes by modifying
the text then get_width() always returns the value 1. (This may have
something to do with the fact that the set_label() method is called
from an event handler.) Maybe there is a Pango call to find out the
width that some text is going to have?

The reason that I want to know this is that I have a Label of which
the text needs to change very frequently. The width of this Label is
one of the things that determines the width of my window. I don't like
the fact that changing the text of the label results in a change of
the width of the window all the time. Therefore, I would like to allow
the window to grow when the text doesn't fit anymore but not to shrink
when the text becomes less wide. I could do this if I know the natural
width of the text.

Thank you for your information!
Chris


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]