2013-06-03 2 views
0

J'essaye de créer un wx.Image, puis de l'ajouter à un wx.BoxSizer et d'obtenir un TypeErrorwx.Python - TypeError: wx.Window, wx.Sizer, Wx.Size ou (w, h) attendus

Traceback (most recent call last): 
    File "gui.py", line 72, in <module> 
    frame = CardFrame(None, cards[0]) 
    File "gui.py", line 45, in __init__ 
    imgSizer.Add(imgImage, 0, wx.ALL) 
    File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 12697, in Add 
    return _core_.Sizer_Add(*args, **kwargs) 
TypeError: wx.Window, wx.Sizer, wx.Size, or (w,h) expected for item 

image est une chaîne pointant vers le chemin de l'image (~/app/statique/imgs/grizzly_bear.png)

image = os.path.join(IMGS, card.img) 
bkg = wx.Panel(self) 
#... 
imgSizer = wx.BoxSizer(wx.HORIZONTAL) 
imgSizer.SetMinSize((240, 120)) 
#... 
imgImage = wx.Image(image, wx.BITMAP_TYPE_ANY) 
#... 
imgSizer.Add(imgImage, 0, wx.ALL) 
#... 
topSizer.AddMany(imgSizer, 0, wx.ALL) 

Répondre

Questions connexes