I have a doubt

Hi,

I just put this into the python shell and did not get the same error:

class Frame1(wx.Frame):
… def init(self, parent, title):
… wx.Frame.init(self, parent, -1, title, pos=(150, 150), size=(350, 250))
… menuBar = wx.MenuBar()
… menu.wx.Menu()
… menu.Append(wx.ID_EXIT, “Exit”, “get out of here”)
… self.Bind(wx.EVT_MENU, self.OnQuitButton, id=wx.ID_EXIT)

By the way, do you not want to do the following:

class Frame1(wx.Frame):

def __init__(self, parent, title):

    wx.Frame.__init__(self, parent, -1, title, pos=(150, 150), size=(350, 250))menuBar = wx.MenuBar()

    menu = wx.Menu()  # This line is different?

    menu.Append(wx.ID_EXIT, "Exit", "get out of here")

    self.Bind(wx.EVT_MENU, self.OnQuitButton, id=wx.ID_EXIT)

I would still suggest that you try this by creating a file containing your code. Am I missing the point here? Did you really want to do this via pyshell?

Cheers!!

Dermot Doran
EMC2
GTS Solutions Level 2
Office: +31-20-7768439
Mobile: +31-6-55815258

···

From: kavitha [mailto:mkavitha@krishtelemaging.com]
Sent: 17 August 2005 10:01
To: wxpython-users@lists.wxwidgets.org
Subject:
[wxPython-users] I have a doubt

can anyone helpme to solve this problem

class Frame1(wx.Frame):
def init(self, parent, title):
wx.Frame.init(self, parent, -1, title, pos=(150,150), size=(350,250))
menuBar = wx.MenuBar()
menu.wx.Menu()
menu.Append(wx.ID_EXIT, “E&xit\tAlt-X”, “Exit the program”)

self.Bind(wx.EVT_MENU, self.OnQuitButton, id=wx.ID_EXIT)

I GOT THE ERROR LIKE THIS WHAT I HAVE TO INCLUDE

Traceback (most recent call last):
File “<pyshell#108>”, line 1, in -toplevel-
self.Bind(wx.EVT_BUTTON, self.OnQuitButton, quitBtn)
NameError: name ‘self’ is not defined

TELL ME IMME PLEASE