def submit_form(self):
        """Treat data and, if valid, setup form to exit."""
        ### instantiate form_data dict and reference it
        ### in local variable
        data = self.form_data = {}

        ### populate dict

        for widget in self.widgets:

            try:
                method = widget.get
            except AttributeError:
                continue
            else:
                value = method()

            data[widget.name] = value

        ### exclude the 'image_type' key from the data,
        ### since the data is already present in the
        ### filepath (the extension of the file), and
        ### the widget from which it was retrieved is
        ### just there for convenience (to make it easier
        ### to switch between different image types)
        data.pop("image_type")

        ### calculate the size of the new image taking
        ### the margins into account

        data["width"] = (data["horizontal_margin"] * 2) + self.size[0]

        data["height"] = (data["vertical_margin"] * 2) + self.size[1]

        ### trigger the exit of the form by setting
        ### special flag to False
        self.running = False
Treat data and, if valid, setup form to exit.
nodezator/editing/imageexport/form.py