473,549 Members | 2,745 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[Newb] Still not able to solve class attribution

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.SetStatusT ext('Current image: ' + self.jpgList[self.curJpg])
img = wx.Image(self.j pgList[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(i mg)
img = wx.BitmapFromIm age(img)
self.Image.SetB itmap(img) <<<<<<<<<<<<<<< <<<<<<<<Probl em
self.txtFName.C lear()
filen = self.GetFName(s elf.jpgList[self.curJpg])
self.txtFName.W riteText(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.O nInit)
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'
Jul 18 '05 #1
3 1421
Knoppix User wrote:
class GIP(wx.Frame):
def __init__(self, parent, ID, title):
wx.Frame.__init __(self, parent, ID, title, size = (600, 460))

....

Just an idea: how about moving the following statement up immediately after
the wx.Frame.__init __(...). The DisplayImg() method *could* be called in
the code you abbreviate with the above four dots.
self.Image = wx.StaticBitmap (self, -1,
wx.EmptyBitmap( *self.thumbSize ),
pos = (160,10)) <<<<<<<<<<<<<<< <<<<<I thunk I dunnit here!


Peter

Jul 18 '05 #2
On Sun, 11 Jan 2004 18:36:22 +0100, Peter Otten wrote:
Just an idea: how about moving the following statement up immediately after
the wx.Frame.__init __(...). The DisplayImg() method *could* be called in
the code you abbreviate with the above four dots.


Thanks for the idea Peter. No go. I did think of that earlier, and checked
a printout very carefully to make sure about that.

Anyway, I did move it up to be the first method after __init__, just to
check again.

:-(

Steve
Jul 18 '05 #3
On Sun, 11 Jan 2004 18:36:22 +0100, Peter Otten wrote:

You were on the right track, Peter!

Your comment go me thinking some more. The error was not in the last line,
but the second to last.

I have quite a long init method, and the conflict was between the code
that sets up the StaticBitmap, and a prior reference to that code, from a
Button.

Thanks for jarring my mind-track in the right direction!!!!

Steve
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1234
by: Knoppix User | last post by:
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,...
43
16009
by: dan baker | last post by:
I have a page that gets loaded with a meta-refresh hardcoded so that a few things on the page get updated. its kind of a fake chat board. anyway, what I need to do is turn off the meta-refresh once someone clicks in a <textarea> to enter their input; otherwise the refresh catches them in the middle and messes up the focus. I need a way to...
20
2656
by: Jacob Friis Larsen | last post by:
I have used DHTMLcentral.com's Coolmenus, but I'd like to find a more simple one. Any advice? Thanks, Jacob
2
2249
by: Irish | last post by:
Hello all.... 1st post here I was hoping someone could tell me how you test the datatype of a variable in C++? Like if I declare struct ELEMENT{int key;} variable1; OR
2
1180
by: Benign Vanilla | last post by:
I created a web site in ASP that is heavily data driven. On the home page, http://iheartmypond.com/. The list of categories is gathered from the database. I grab the distinct top level categories, and show them with the first five level 1 sub categories. I then loop through the list and using response.write, I build a table that formats the...
5
1906
by: Richard Shewmaker | last post by:
Hi. I've been using CSS for basic stuff, mostly concerning fonts. I want to get going with using CSS fully. Two days ago I purchased O'Reilly's "Cascading Style Sheets" and "CSS Cookbook." I've been reading them and have tried some really basic stuff and am not having a very good time (lol). I'm feeling really stupid, to be honest. I was...
14
1487
by: manstey | last post by:
Hi, Is there a clever way to see if two strings of the same length vary by only one character, and what the character is in both strings. E.g. str1=yaqtil str2=yaqtel they differ at str1 and the difference is ('i','e') But if there was str1=yiqtol and str2=yaqtel, I am not interested.
0
1393
by: gchandran | last post by:
Hello, I am developing a DLL using C# . I am using VS 2005 for this. The component will expose few API's. One of the API performs certain operations and needs to return an array of objects (class defined in the C# dll). I have a C++ executable which instantiates the C# DLL and invokes the API's. I am using SAFEARRAY to pass the array of...
4
4216
by: sklett | last post by:
I'm revisiting an old series of overloaded methods I have and I would like to convert them to a single generic method. Here is the method in it's current, overloaded implementation: <code> public StringCustomFieldRef GetStringField(string fieldID, CustomRecord record) { if(record.customFieldList == null) { return null;
0
7450
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7809
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1941
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1059
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.