WxPython: 'App' 对象没有属性 'Mainloop'
WxPython: 'App' object has no attribute 'Mainloop'
所以,我正在尝试学习有关使用 WxPython 制作应用程序的 RealPython 教程,但我 运行 遇到了错误。
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'App' object has no attribute 'Mainloop'
我什么都试过了,但总是报错。
我该如何解决?
作为参考,这是我尝试使用的代码 运行:
import wx
app = wx.App()
frame = wx.Frame(parent=None, title="Hello, world!")
frame.Show()
app.Mainloop()
app
有一个 MainLoop
属性,不是 Mainloop
注意大写 "L"
为了将来参考,您可以使用 dir
函数,即
print (dir(app))
这将向您显示可用的内容。
import wx
app = wx.App()
frame = wx.Frame(parent=None, title="Hello, world!")
frame.Show()
app.MainLoop()
所以,我正在尝试学习有关使用 WxPython 制作应用程序的 RealPython 教程,但我 运行 遇到了错误。
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'App' object has no attribute 'Mainloop'
我什么都试过了,但总是报错。
我该如何解决?
作为参考,这是我尝试使用的代码 运行:
import wx
app = wx.App()
frame = wx.Frame(parent=None, title="Hello, world!")
frame.Show()
app.Mainloop()
app
有一个 MainLoop
属性,不是 Mainloop
注意大写 "L"
为了将来参考,您可以使用 dir
函数,即
print (dir(app))
这将向您显示可用的内容。
import wx
app = wx.App()
frame = wx.Frame(parent=None, title="Hello, world!")
frame.Show()
app.MainLoop()