【问题标题】:wxPython- "no module named Panel" errorwxPython-“没有名为 Panel 的模块”错误
【发布时间】:2014-04-19 23:25:22
【问题描述】:

我正在使用 wxPython 编写一个 GUI 应用程序。但每次我收到“没有名为 Panel 的模块”错误。任何人都可以建议为什么.. 我的代码是这样的

class Player1(wx.Frame):
    def _init_(self, parent, id, title):
        wx.Frame._init_(self, parent, id, title, size=(350,300))
        self.panel =wx.Panel(self)

我正在使用 Python 2.7。 我尝试卸载并重新安装 wxPython 两次,但它不起作用。

【问题讨论】:

  • 你能发布一个可运行的例子吗?

标签: wxpython


【解决方案1】:

尝试执行下面的代码,如果出现任何错误请告诉我:

代码:

import wx

class Player1(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, style=wx.DEFAULT_FRAME_STYLE)
        myPanel = wx.Panel(self,-1)
        myButton = wx.Button(myPanel, -1, 'Download', size=(100,50), pos=(20,20))
        self.Show(True)
app = wx.App()
frame = Player1(None, wx.ID_ANY, 'Image')
app.MainLoop()

【讨论】:

    猜你喜欢
    • 2022-10-20
    • 1970-01-01
    • 2020-02-12
    • 2017-12-26
    • 2019-01-17
    • 2014-12-25
    • 2018-04-29
    • 2011-06-26
    • 2017-01-07
    相关资源
    最近更新 更多