简体   繁体   English

wxPython,wxButton 上的多行 label

[英]wxPython, multiline label on wxButton

I'm trying to get a label on a button to be on two or more lines.我试图让一个按钮上的 label 在两行或多行上。 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.然而,当我运行该应用程序时,我只是在一行中看到一个带有“testtest”的按钮,即 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平台:Windows,7 64bit 和 XP 测试
  • wxPython version: 2.8 unicode wxPython版本:2.8 unicode
  • Python version: 2.7.1 Python 版本:2.7.1

It appears to be a confirmed bug in wxWidgets: http://trac.wxwidgets.org/ticket/12491这似乎是 wxWidgets 中已确认的错误: http://trac.wxwidgets.org/ticket/12491

If you give the button a multi-line label at creation, SetLabel will then allow multiple lines.如果在创建时为按钮提供多行 label,则SetLabel将允许多行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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