Help in wxpython
Dietmar Schwertberger
news at schwertberger.de
Thu Dec 3 05:09:06 EST 2009
On Wed, 2009-12-02 at 00:20 -0800, madhura vadvalkar wrote:
>> def InitBuffer(self):
>>
>> size=self.GetClientSize()
>> self.Buffer=wx.EmptyBitmap(size.width,size.height)
>> dc=wx.BufferedDC(None,self.buffer)
>> dc.SetBackground(wx.Brush(self.GetBackgroundColour()))
>> dc.Clear()
>> self.Drawcircle(dc)
>> self.reInitBuffer=False
>> I am getting the following error:
>>
>> Traceback (most recent call last):
>> File "C:/Python26/circle.py", line 42, in <module>
>> frame=SketchFrame(None)
>> File "C:/Python26/circle.py", line 38, in __init__
>> self.sketch = SketchWindow(self, -1)
>> File "C:/Python26/circle.py", line 12, in __init__
>> self.InitBuffer()
>> File "C:/Python26/circle.py", line 19, in InitBuffer
>> dc=wx.BufferedDC(None,self.buffer)
>> AttributeError: 'SketchWindow' object has no attribute 'buffer'
>>
>> Please tell me what I am doing wrong.
As the traceback suggests, self.buffer does not exist. You need to write
self.Buffer.
I did not have a further look or try the code.
Did you have a look at the wxPython demo?
The demo "Core Windows/Controls -> ScrolledWindow" is probably very
similar to what you want.
Krishnakant schrieb:
> Madhura, Sorry to be a bit off-topic, but, I would really recommend you
> to use pygtk instead of wx.
> For one thing, the developers at pygtk are very active (they have their
> mailing list as well ) and it comes by default with python on almost all
> linux distros. You can also easily install it on windows.
>
> Most important, the api for pygtk is closely similar to wx.
> Not to mention the quick responses you will get with pygtk related
> problems.
That's also true for wxPython on the related mail lists:
http://www.wxpython.org/maillist.php
Regards,
Dietmar
More information about the Python-list
mailing list