GUI woes

Kartic removethis.kartic.krishnamurthy at gmail.com
Sat Apr 23 22:07:25 EDT 2005


The Great jeff elkins uttered these words on 4/23/2005 5:45 PM:

> test.py crashes with the error below. Any clues?  
> 
> ===========
> 
> Running test.py: 
> 
> Traceback (most recent call last):
>   File "./test.py", line 87, in ?
>     app = MyApp(0)     # Create an instance of the application class
>   File "/usr/lib/python2.3/site-packages/wxPython/wx.py", line 1951, in 
> __init__
>     _wxStart(self.OnInit)
>   File "./test.py", line 76, in OnInit
>     frame = MyFrame(None, -1, "This is a test")
>   File "./test.py", line 26, in __init__
>     self.Bind(wx.EVT_SIZE, self.OnSize)
> AttributeError: MyFrame instance has no attribute 'Bind'

Jeff - Could you please post your code?

 From what you have posted it looks like your MyFrame class does not 
inherit from wx.Frame.

Your class should be defined like this:
class MyFrame(wx.Frame):
	def __init__(self, parent, id, title, pos, size, style):
		wx.Frame.__init__(self, parent, id, title, pos, size, style)
		self.Bind(wx.EVT_SIZE, self.OnSize)
		self.Show(True)

Thanks,
-Kartic



More information about the Python-list mailing list