Hi all, I have a problem. I want to add items to a Menu iteratively and I'm stuck. Heres a snippet of my code
fileMenuChoices=[('&New','Start a New Document',self.onClick), ('&Open File...','Open an Existing Document', self.onClick), ('&Save','Save Current Document', self.onClick), ('---'), ('E&xit','Close Window', self.onClick), ('&About','Information', self.onClick)] ..... ..... ..... ..... fileMenu = wxMenu() for opt in fileMenuChoices: fmID = wxNewId() if(opt[0] != '-'): fileMenu.Append(fmID,opt[0], opt[1]) EVT_MENU(self,fmID,opt[2]) else: fileMenu.AppendSeparator() #Creating the MenuBar menuBar = wxMenuBar() menuBar.Append(fileMenu, "&File") self.SetMenuBar(menuBar) #Add menubar to the Frame (Window) def onClick(self,e): ....... ....... The problem is I get an error saying name 'self' not defined... Any help will be appreciated -- http://mail.python.org/mailman/listinfo/python-list