Adding FTP upload to the GUI

Our FTP upload function is ready to go, so let's add the necessary bits to the rest of our application to make it all work together.

We'll start by adding the FTP host and port to the SettingsModel in models.py:

    variables = {
        ...
        'abq_ftp_host': {'type': 'str', 'value': 'localhost'},
        'abq_ftp_port': {'type': 'int', 'value': 2100}
        ...

Remember that our test FTP uses port 2100, not the usual port 21, so we'll make 2100 the default for now.

Now, we'll move over to application.py and create the callback method that will create the CSV file and pass it to the FTP upload function.

Create a new method in the Application object:

    def upload_to_corporate_ftp(self):
        csvfile = self._create_csv_extract()

The first thing ...

Get Python GUI Programming with Tkinter 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.