環境:Anaconda3 Python3.6 wxPython4.0
問題:在嘗試為程式添加啟動圖片時,網上找到了一段代碼如下:
import wx
class PaintApp(wx.App):
def OnInit(self):
bmp = wx.Image("wxPython.JPG")
wx.SplashScreen(bmp,wx.SPLASH_CENTER_ON_SCREEN | wx.SPLASH_TIMEOUT,1000,None,-1)
wx.Yield()
frame = PaintFrame(None)
frame.Show(True)
self.SetTopWindow(frame)
return True
if __name__ == '__main__':
app = PaintApp()
app.MainLoop()
沒有其他錯誤,只提示“AttributeError: module 'wx' has no attribute 'SplashScreen'”。
運行普通表單程式都沒有問題,只有在用到wx.SplashScreen()時才報錯,網上找了很久也幾乎沒有相似的錯誤,會不會是版本問題?
在此先謝過各位大佬
uj5u.com熱心網友回復:
3.0 可以的,你用的是哪個版本?uj5u.com熱心網友回復:
from wx import advadv.SplashScreen(bmp,
adv.SPLASH_CENTER_ON_SCREEN | adv.SPLASH_TIMEOUT,
3000,
None,
-1)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/80750.html
下一篇:pygame問題
