import wx

class McaMenu(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(640, 432))

menubar = wx.MenuBar()
file = wx.Menu()
new = wx.MenuItem(file, 1, '&New\tCtrl+N', 'Creates a new document')
file.AppendItem(new)
file.AppendSeparator()


open = wx.MenuItem(file, 2, '&Open\tCtrl+O', 'Open New document')
file.AppendItem(open)


save = wx.MenuItem(file, 3, '&Save\tCtrl+S', 'Save')
file.AppendItem(save)


save = wx.MenuItem(file, 4, '&Save As...', 'Save As...')
file.AppendItem(save)
file.AppendSeparator()


Print = wx.MenuItem(file, 5, '&Print', 'Print')
file.AppendItem(Print)


PrintPreview = wx.MenuItem(file, 6, '&Print Preview', 'Print Preview')
file.AppendItem(PrintPreview)


PrintSetup = wx.MenuItem(file, 7, '&Print Setup', 'Print Setup')
file.AppendItem(PrintSetup)


RecentFile = wx.MenuItem(file, 8, '&Recent File', 'Recent File')
file.AppendItem(RecentFile)
file.AppendSeparator()


quit = wx.MenuItem(file, 9, '&Quit\tCtrl+Q')
file.AppendItem(quit)
self.Bind(wx.EVT_MENU, self.OnQuit, id=9)

menubar.Append(file, '&File')
self.SetMenuBar(menubar)

Edit = wx.Menu()
Edit.Append(1, 'Selection', 'Quit application')
Edit.Append(2, 'Cut', 'Quit application')
Edit.Append(3, 'Copy', 'Quit application')
Edit.Append(4, 'Paste', 'Quit application')
menubar.Append(Edit, '&Edit')
self.SetMenuBar(menubar)

View = wx.Menu()
###the python gives on this line and held my system###
self.shtl = view.Append(1, 'Show toolbar', 'Show Toolbar', kind=wx.ITEM_CHECK)
view.Check(1, True)

self.Bind(wx.EVT_MENU, self.ToggleToolBar, id=1)

self.toolbar = self.CreateToolBar()
self.toolbar.Realize()

def ToggleToolBar(self, event):
if self.shtl.IsChecked():
self.toolbar.Show()
else:
self.toolbar.Hide()
self.Centre()
self.Show(True)

self.shst = view.Append(2, 'Status Bar', 'Status Bar', kind=wx.ITEM_CHECK)
view.Check(2, True)
self.Bind(wx.EVT_MENU, self.ToggleStatusBar, id=2)


def ToggleStatusBar(self, event):
if self.shst.IsChecked():
self.statusbar.Show()
else:
self.statusbar.Hide()
self.Centre()
self.Show(True)
View.Append(3, 'Delete Rows', 'Quit application')
menubar.Append(View, '&View')
self.SetMenuBar(menubar)

Graph = wx.Menu()
Graph.Append(1, 'Adjust Plot', 'Quit application')
Graph.Append(2, 'Scatter Plot', 'Quit application')
Graph.Append(3, 'Predict Plot', 'Quit application')
Graph.Append(4, 'Fitted vs Residual', 'Quit application')
Graph.Append(5, 'Variable vs Residual', 'Quit application')
Graph.Append(6, 'Ext Std Residual vs Fitted', 'Quit application')
menubar.Append(Graph, '&Graph')
self.SetMenuBar(menubar)

Data = wx.Menu()
Data.Append(1, 'Settings', 'Quit application')
Data.Append(2, 'Summary', 'Quit application')
Data.Append(3, 'Row Operation', 'Quit application')
Data.AppendSeparator()

Rowoperation = wx.Menu()
Rowoperation.Append(1, 'Add')
Rowoperation.Append(1, 'Delete')
Rowoperation.Append(1, 'Undelete All')

Data.AppendMenu(1, '&Rowoperation', Rowoperation)


menubar.Append(Data, '&Data')
self.SetMenuBar(menubar)

Variable = wx.Menu()
Variable.Append(1, 'Destroy', 'Quit application')
Variable.Append(2, 'Interactioin', 'Quit application')
Variable.Append(3, 'Transformation', 'Quit application')
menubar.Append(Variable, '&Variable')
self.SetMenuBar(menubar)

Correlation = wx.Menu()
Correlation.Append(1, 'Matrix', 'Quit application')
Correlation.Append(2, 'New Model', 'Quit application')
Correlation.Append(3, 'Destroy Model', 'Quit application')
Correlation.Append(4, 'Previous Model', 'Quit application')
menubar.Append(Correlation, '&Correlation')
self.SetMenuBar(menubar)

Prediction = wx.Menu()
Prediction.Append(1, 'Input Sheet', 'Quit application')
Prediction.Append(2, 'Result Sheet', 'Quit application')
Prediction.Append(3, 'Clear Input Sheet', 'Quit application')
menubar.Append(Prediction, '&Prediction')
self.SetMenuBar(menubar)

Reseduals = wx.Menu()
Reseduals.Append(1, 'All', 'Quit application')
Reseduals.Append(2, 'Delete Rows', 'Quit application')
Reseduals.Append(3, 'Included Rows', 'Quit application')
Reseduals.Append(4, '1st Outlier table', 'Quit application')
Reseduals.Append(5, '2nd Outlier table', 'Quit application')
menubar.Append(Reseduals, '&Reseduals')
self.SetMenuBar(menubar)

Help = wx.Menu()
Help.Append(1, 'Help Topics', 'Quit application')
Help.Append(2, 'About MCA', 'Quit application')
menubar.Append(Help, '&Help')
self.SetMenuBar(menubar)

self.Centre()
self.Show(True)

def OnQuit(self, event):
self.Close()

app = wx.App()
McaMenu(None, -1, 'MCA menu')
app.MainLoop()

kindly check this code and explain the possible error that i am making.
Regards
Punter

If you use code tags, I will take a look at your code.

Please use the [code] and [/code] tag pair to enclose your code. This way the proper indentations will show, making your code readable.

Put your code in code tags, and try to boil it down to what is going wrong a little.

Your 'View' and 'view' should be the same caps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.