K
Knoppix User
Hi folks
I still have not been able to solve this one, which didn't manage to
garner a response yesterday, so I'm rephrasing it here.
If I define an attribute in the __init__ statement of a class, I should be
able to access that attribute in a later method of that class, right?
I have run into a situation where that does not SEEM to happen [newbie
alert].
What should I be looking into to try to solve this bug, as I am SOL with
new ideas?!
Although I am using wx, I do not believe that this has anything to do with
wx, but with syntax / semantics.
Any thoughts are very much appreciated.
I copy the original question below, for convenience.
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'
I still have not been able to solve this one, which didn't manage to
garner a response yesterday, so I'm rephrasing it here.
If I define an attribute in the __init__ statement of a class, I should be
able to access that attribute in a later method of that class, right?
I have run into a situation where that does not SEEM to happen [newbie
alert].
What should I be looking into to try to solve this bug, as I am SOL with
new ideas?!
Although I am using wx, I do not believe that this has anything to do with
wx, but with syntax / semantics.
Any thoughts are very much appreciated.
I copy the original question below, for convenience.
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'