简体   繁体   中英

wxPython, multiline label on wxButton

I'm trying to get a label on a button to be on two or more lines. I want to update this at runtime. I did like this:

self.btnGroupOne.SetLabel(u"test\ntest")

Yet, when I run the app, i just get a button with "testtest" on a single line as the label.

Am I forgetting a property that allows multiline labels or something?

BTW, when I do this:

self.btnNieuwTicket = wx.Button( self, wx.ID_ANY, u"Nieuw\nTicket", wx.DefaultPosition, wx.Size( 80,80 ), 0 )

the multiline does work...

  • Platform: Windows, both 7 64bit and XP tested
  • wxPython version: 2.8 unicode
  • Python version: 2.7.1

It appears to be a confirmed bug in wxWidgets: http://trac.wxwidgets.org/ticket/12491

If you give the button a multi-line label at creation, SetLabel will then allow multiple lines.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM