gpt4 book ai didi

linux - wxPython -- 转义的 & 符号在 Linux 中仍然不显示

转载 作者:太空宇宙 更新时间:2023-11-04 03:55:01 27 4
gpt4 key购买 nike

我正在开发一个带有 wx.StaticText 对象的应用程序。我想显示一个&符号(“&”),因此我的标签有“&&”来逃避热键快捷键。这是商定的解决方案,当我在 Windows 中运行我的应用程序时它可以工作。

但在 Linux (Ubuntu 12.04) 中,我仍然缺少 & 符号。以前有人遇到过这个问题吗?

最佳答案

以下代码适用于我在 XUbuntu 14.04 上使用 wxPython 2.8.12 和 Python 2.7 的情况:

import wx

########################################################################
class MyFrame(wx.Frame):
""""""

#----------------------------------------------------------------------
def __init__(self):
"""Constructor"""
wx.Frame.__init__(self, None, title="Amp")
panel = wx.Panel(self)

txt = "The king && I"
lbl = wx.StaticText(panel, label=txt)

self.Show()

if __name__ == "__main__":
app = wx.App(False)
frame = MyFrame()
app.MainLoop()

它产生以下结果:

enter image description here

关于linux - wxPython -- 转义的 & 符号在 Linux 中仍然不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25046079/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com