StaticText and sizers

Hi all,

I have a problem with wx.StaticText :

When i put a StaticText in a FlexgridSizer, it doesnt expand with the sizer when
i resize the frame. Its really a problem : How can i do ?

(I'm french, so sorry for my english)

Thx for your answer !

Ivan, et al.

I actually had similar troubles. I wanted the text field to scale
horizontally only, but the best I could do was to scale with wx.SHAPED
or wx.EXPAND. For a single-line text field, this tends to be a pretty
ugly solution.

sizer.Add(item=textfield, proportion=1, flag=wx.SHAPED, border=0)

Does anyone know how to get a single line textField to scale properly?

-Adam

···

On Tue, Oct 7, 2008 at 2:11 PM, Ivan <gg4D@orange.fr> wrote:

Hi all,

I have a problem with wx.StaticText :

When i put a StaticText in a FlexgridSizer, it doesnt expand with the sizer when
i resize the frame. Its really a problem : How can i do ?

(I'm french, so sorry for my english)

Thx for your answer !

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Adam and Ivan,

Ivan, et al.

I actually had similar troubles. I wanted the text field to scale
horizontally only, but the best I could do was to scale with wx.SHAPED
or wx.EXPAND. For a single-line text field, this tends to be a pretty
ugly solution.

sizer.Add(item=textfield, proportion=1, flag=wx.SHAPED, border=0)

Does anyone know how to get a single line textField to scale properly?

-Adam

Hi all,

I have a problem with wx.StaticText :

When i put a StaticText in a FlexgridSizer, it doesnt expand with the sizer when
i resize the frame. Its really a problem : How can i do ?

(I'm french, so sorry for my english)

Thx for your answer !

__

The StaticText widget isn't for scaling text, hence the term "static". Using my imagination, I would think you could catch the size event and resize the text accordingly. Just bind to EVT_SIZE or EVT_SIZING and get the size of the frame. Depending on that size, set the font on the StaticText widget.

Alternatively, I'm sure you could just draw the text using FloatCanvas or DCs based on the frame size. This method would probably give you more granular control than just setting the font. Unfortunately, this area of wx isn't my forte. Hopefully the guys that use these can lend their advice.

···

On Tue, Oct 7, 2008 at 2:11 PM, Ivan <gg4D@orange.fr> wrote:

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

Ivan wrote:

Hi all,

I have a problem with wx.StaticText :

When i put a StaticText in a FlexgridSizer, it doesnt expand with the sizer when
i resize the frame. Its really a problem : How can i do ?

Please provide a small sample that shows the problem so we can see exactly what you are trying to do and how you are doing it.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn <robin <at> alldunn.com> writes:

thx for having a look on my problem :

But I have found today this post in archives :

http://article.gmane.org/gmane.comp.python.wxpython/56713

You explain here a answer that works - but not perfectly (the display is poorly
updated).

Maybe are you working on a better solution for next version of WxPython ?

(I take this opportunity to let you Thx for your great work on wxPython and for
his book !)