我正在尝试创建一个自定义对话框来显示信息。它在按下按钮时被激活,并且该机制运行良好。但是,对话框本身已损坏。任何帮助表示赞赏。
import wx
class ForgotPass(wx.Dialog):
def __init__(self, *args, **kwargs):
super(ForgotPass, self).__init__(*args, **kwargs)
self.InitUI()
def InitUI(self):
self.panel = wx.Panel(self)
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.title = wx.StaticText(self.panel, label='Forgotten Your Password?', style=wx.ALIGN_CENTER)
self.title.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, underline=True)) # Underlined & Bold
self.sizer.Add(self.title)
self.text = wx.StaticText(self.panel, label="Contact 'TheHiguty' via ingame PM to have your password reset!", style=wx.ALIGN_CENTER)
self.sizer.Add(self.text)
self.SetSizer(self.sizer)
self.SetSize((200, 150))
self.SetTitle('Forgotten Your Password')
self.Center()
self.Show(True)
def main():
app = wx.App(False)
ForgotPass(None)
app.MainLoop()
if __name__ == "__main__":
main()
但是,我没有正确显示文本,而是得到了这个:
非常感谢任何解决此问题的帮助!