From the course: Rapid Application Development with Python
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Compose a menu bar - Python Tutorial
From the course: Rapid Application Development with Python
Compose a menu bar
- [Instructor] We'll often want to use a menu in an application and have some hotkeys to provide fast selection of key menu items. Let's see how we do this in wxPython. I'll add the Menu bar widget. Because this is all handled within the initialization function, I don't need to use the self prefix on the working variables. Menubar is a wx.MenuBar widget. And I can now start creating the submenu items. Menu_1 is a wx.Menu widget. I'll add four entries to the submenu list, using the append method. M_new is menu_1.Append. Wx.ID_ANY and we'll call this New. M_open equals menu_1.Append. Wx.ID_ANY, Open. M_recent is menu_1.Append, wx.ID_ANY, Recent. And m_quit is menu_1.Append, wx.ID_ANY, and the menu item is Quit\tCtrl+Q. I've kept a handle for each menu item so that each menu selection can have an event handle. Having created the menu, I can add it to the menu bar and give it a top-level name…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Introducing wxPython2m 13s
-
(Locked)
Class-based skeleton4m 37s
-
(Locked)
Labels and buttons3m 38s
-
(Locked)
More on buttons3m 33s
-
(Locked)
Checkboxes and radio buttons6m 43s
-
(Locked)
Text entry controls4m 36s
-
(Locked)
Use spinners to set values4m 58s
-
(Locked)
Create lists to select from6m 9s
-
(Locked)
Use combo boxes54s
-
(Locked)
Compose a menu bar6m 46s
-
(Locked)
Challenge36s
-
(Locked)
Solution2m 54s
-
-
-
-