How it works...

In GUI_copy_files.py, we add two buttons and two entries to Tab 2 of our GUI. We are not yet implementing the functionality of our button callback function.

Clicking the Browse to File... button currently prints hello from getFileName to the console. We can use the tkinter built-in file dialogs after adding the import statements.

We can now use the dialogs in our code. Instead of hardcoding a path, we can use Python's os module to find the full path to where our GUI module resides. Clicking the Browse to File... button now opens up the askopenfilename dialog. We can now open a file in this directory or browse to a different directory. After selecting a file and clicking the Open button in the dialog, we will save the full ...

Get Python GUI Programming Cookbook - Third Edition 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.