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 Python GUI Programming - A Complete Reference Guide now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.