[Newb] Attribute error

Knoppix User knoppix at laptop.home.net
Sat Jan 10 23:35:19 CET 2004


Hi folks

There is obviously something that is escaping me - please help!!

I have cut and pasted the relevant portions of text from a script I am
writing in my quest to learn the Python.

Could someone explain the attribution error to me? See the end of the
listing for the error. I have created the Image object(?) as a
wx.StaticBitmap, so whazzamatter.

Thanks for pointers
Steve




class GIP(wx.Frame):
    def __init__(self, parent, ID, title):
        wx.Frame.__init__(self, parent, ID, title, size = (600, 460))

        ....

       self.Image = wx.StaticBitmap(self, -1, wx.EmptyBitmap(*self.thumbSize),
            pos = (160,10))     <<<<<<<<<<<<<<<<<<<<I thunk I dunnit here!

       ....

    def DisplayImg(self, rot):
        self.SetStatusText('Current image: ' + self.jpgList[self.curJpg])
        img = wx.Image(self.jpgList[self.curJpg], wx.BITMAP_TYPE_JPEG)
        if rot == 90:
            img = img.Rotate90()
        elif rot == 180:
            img = img.Rotate(1, (0,0))
        elif rot == 270:
            img = img.Rotate(1.5, (0,0))
        img = self.ScaleImg(img)
        img = wx.BitmapFromImage(img)
        self.Image.SetBitmap(img)      <<<<<<<<<<<<<<<<<<<<<<<Problem
        self.txtFName.Clear()
        filen = self.GetFName(self.jpgList[self.curJpg])
        self.txtFName.WriteText(filen)
        self.txtDirName.SetLabel(self.dirName)


Traceback (most recent call last):
  File "/usr/lib/python2.3/site-packages/sm/scriptutils.py", line 49, in run
    exec codeObject in mainDict
  File "<source>", line 197, in ?
  File "/usr/lib/python2.3/site-packages/wxPython/wx.py", line 1951, in __init__
    _wxStart(self.OnInit)
  File "<source>", line 191, in OnInit
  File "<source>", line 78, in __init__
  File "<source>", line 116, in DisplayImg
AttributeError: GIP instance has no attribute 'Image'



More information about the Python-list mailing list