[EMAIL PROTECTED] wrote: > >I tried to follow wxPython Demo examples to understand it better. I >used wxGlade to generate my code from the GUI builder. > >When I try to see the code for Menu and Menubar I see a little mismatch >in the way functions are being used. > >For example, wxGlade produces code like this > >self.Action = wx.Menu() >self.AddComputer = wx.MenuItem(self.Action, wx.NewId(), _("Add >Computer"), "",wx.ITEM_NORMAL) >self.Action.AppendItem(self.AddComputer) >## Code end > >and in the demo it is gives as > >self.Action = wx.Menu() >Action.append(201, "Add Computer") ># Code end > >Can somebody please explain this discrepancy ?
It's not really a "discrepancy". It's just that the latter example is a shortcut for the first. (Well, it would be a shortcut if you used "201" instead of "wx.NewId() in the first.) wxPython has, over the years, developed sensible shortcuts for many common operations. The GUI generators tend to use the "long" way, since that tends to be the original method that will work with any version. Also note that, in the first example, you are given a wx.MenuItem object to work with, should you need it. The second example hides it. It is rarely necessary to access a wx.MenuItem directly, so this is not usually an issue. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list