I'm still a newbie, but am determined to figure this out!
I'm starting with menus, but I can easily adapt it to everything else. I just don't see the data structure yet.
Here is my base file:
Code:
#!/usr/bin/evy python
'''create basic window, with a button, status/menu bar and dialog boxes'''
import wx
class App(wx.App):
def OnInit(self):
frame=MyFrame(None,-1,"everything so far")
frame.Show()
return True
class MyFrame(wx.Frame):
def __init__(self,parent,id,name):
wx.Frame.__init__(self,parent,id,name,size=(300,300))
panel=wx.Panel(self)
#panel.setBackgroundColour("White")
button1=wx.Button(panel,label="Clicky",size=(60,20),pos=(10,10))
'''create the statusbar and menubar, then add menu items'''
statusBar=self.CreateStatusBar()
menuBar=wx.MenuBar()
menu1=wx.Menu()
menuBar.Append(menu1,"File")
menu1.Append(wx.NewId(),"Open","Open a file")
self.SetMenuBar(menuBar)
if __name__=="__main__":
app=App()
app.MainLoop()
What I want to do is refactor the "menu1" items to make it an iterable list.
I am following a book, but the code is wrong, (Cut and paste does not turn out correctly)
I have another file that includes a function that returns a tuple:
[CODE def MenuData():
return ("File",("Open","Open a file"))
[/CODE]
not sure what to do from this point
Thank you,
Ash