wxPython uses an internal [event handler], which deals with events from the windowing system. When you Bind something, it adds that to the event handler, which tells it to look out for event X, and do Y when it happens. So in this case, when we use a line like:
self.Bind(wx.EVT_MENU, self.web, m_web)
Were telling the event handler to look out for a menu event coming from the m_web menu item, if it triggers, call self.web. You don't necessarily see this directly in the code because the event handler is whats dealing with it behind the scenes. The triggering of opening the website has nothing to do with wxPython, that is handled by the [webbrowser] library. So, to recap whats happening here, we Bind the m_web menu item to the event handler in wxPython so it will monitor and call self.web if someone triggers it. When triggered, self.web calls webbrowser to open the url in whatever browser there happens to be.
The text string "Your website name here" is purely arbitrary, thats actually a description of the menu item when someone mouses over it that would appear in the statusbar, if it had one. For creating menu's you have a Menu Bar, and Menus. Each Menu represents a single drop down menu, like File, Edit, View, etc. To add options to a drop down menu you Append them, like so:
m_web = menu.Append(wx.ID_SAVE, "W&eb","Your Website Here")
The syntax here is ID, name on the menu, and description, which shows up on the status bar when the menu item is selected. You can add all kinds of items to it if your like, but then you add it to the menubar and giv it a name, in this case "file":
menubar.Append(menu,"File")
So, you create drop down menu's and attach items to them, which are set to watch for events and trigger functions when they happen, then add each menu to the menu bar, and then set the menubar to the current window.
-
BrushTone v1.3.3: Accessible Paint Tool
-
AudiMesh3D v1.0.0: Accessible 3D Model Viewer