multi-line wxButton label

Hello,

When using a wxButton(parent, ID,"Line1\nLine2"), two lines are displayed under Linux; but under MS Windows it's just a single line with the "\n" being a square. Is there a reason for that? Is there a style for wxButton to enable MULTILINE Button Lables?

peter

Hi,

try "\r\n", this will work on Windows ...

Thorsten

Peter Wurmsdobler wrote:

···

Hello,

When using a wxButton(parent, ID,"Line1\nLine2"), two lines are displayed under Linux; but under MS Windows it's just a single line with the "\n" being a square. Is there a reason for that? Is there a style for wxButton to enable MULTILINE Button Lables?

peter

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

--
brainbot technologies AG boppstrasse . 64 . 55118 mainz . germany
fon +49 6131 211639-1 . fax +49 6131 211639-2
http://brainbot.com/ mailto:henni@brainbot.com

Thorsten,

try "\r\n", this will work on Windows ...

I had tried this already, but it does not work. Any other ideas?
peter

Peter Wurmsdobler wrote:

Thorsten,

try "\r\n", this will work on Windows ...

I had tried this already, but it does not work. Any other ideas?
peter

This is a little convoluted sounding, but you could use a recent version of FancyText to generate a bitmap of the text and then pass that to a bitmap button.

bmp = FancyText.RenderToBitmap("some text\nwith a newline")
btn = wx.BitmapButton(self, -1, bmp)

You would probably have to do something more to get the background right, see StaticFancyText for one way to do this.

You can get the current version of FancyText here:

http://starship.python.net/crew/hochberg/

Regards,

-tim

···

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

Tim,

of FancyText to generate a bitmap of the text and then pass that to a bitmap button.

I will try. Alternatively, I use a button with a sime plext underneath.
peter

Peter Wurmsdobler wrote:

Hello,

When using a wxButton(parent, ID,"Line1\nLine2"), two lines are displayed under Linux; but under MS Windows it's just a single line with the "\n" being a square. Is there a reason for that? Is there a style for wxButton to enable MULTILINE Button Lables?

IIRC, when multi-line text in the native button control was enabled some other common usage of the button was broken so it was disabled again. (Sorry I don't rememeber the details.)

The wxGenButton (see wxPython/lib/buttons.py) could probably be updated to display multiple lines, but it wouldn't look the same as the native buttons of course.

···

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

Robin,

IIRC, when multi-line text in the native button control was enabled some other common usage of the button was broken so it was disabled again. (Sorry I don't rememeber the details.)

Thanks for the explanation. I will try with something else then.
peter