How to do it...

Let's create a new application based on the Main Window template. The Main Window template includes a menu at the top by default:

  1. We can even use two push buttons to initiate the file open dialog box and file save dialog box, but using the menu items to initiate file operations will give the feel of a real-time application.
  2. The default menu bar in the Main Window template shows Type Here in place of the menu name.
  3. The Type Here option indicates that the user can type the desired menu name, replacing the Type Here text. Let's type File, creating a menu in the menu bar.
  4. On pressing the Enter key, the term Type Here will appear as a menu item under the File menu.
  5. Let's type Open as the first menu item in the File menu.
  6. On pressing ...

Get Qt5 Python GUI Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.