如何在wxpython中的按钮文本中写一个"&"

sag*_*gar 1 python wxpython

这看起来很简单,但我没有找到任何文档.试过&&,哪个不起作用.想要一个这样的按钮:

Button1=wx.Button(self, 5, "abc&abc", (130, 230))
Run Code Online (Sandbox Code Playgroud)

Mat*_*ttH 5

这对我有用:

import wx

class MainWindow(wx.Frame):
  def __init__(self,parent,title):
    wx.Frame.__init__(self,parent,title=title,size=(200,-1))
    self.sizer = wx.BoxSizer(wx.HORIZONTAL)
    self.buttons = [
      wx.Button(self,-1,"Button &One"),
      wx.Button(self,-1,"Button &&Two"),
    ]
    for btn in self.buttons:
      self.sizer.Add(btn,1,wx.EXPAND)
    self.SetSizer(self.sizer)
    self.SetAutoLayout(1)
    self.sizer.Fit(self)
    self.Show()

app = wx.App(False)
frame = MainWindow(None,"Hello Ampersand")
app.MainLoop()
Run Code Online (Sandbox Code Playgroud)