How it works...

In the callFileDialog.pyw file, you can see that the click() event of the Open menu item with objectName, actionOpen, is connected to the openFileDialog method; when the user clicks the Open menu item, the openFileDialog method will be invoked. Similarly, the click() event of the Save menu item with objectName, actionSave, is connected to the saveFileDialog method; when the user clicks the Save menu item, the saveFileDialog method will be invoked.

In the openFileDialog method, the open file dialog is opened by invoking the getOpenFileName method of the QFileDialog class. The open file dialog enables the user to browse the directories and choose the desired file to open. After selecting the file, when the user clicks the

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.