Book Image

Python GUI Programming Cookbook

By : Burkhard Meier
Book Image

Python GUI Programming Cookbook

By: Burkhard Meier

Overview of this book

Table of Contents (18 chapters)
Python GUI Programming Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Storing and retrieving data from our MySQL database


We will use our Python GUI to insert data into our MySQL database tables. We have already refactored the GUI we built in previous recipes in preparation for connecting and using a database.

We will use two textbox entry widgets into which we can type the book or journal title and the page number. We will also use a ScrolledText widget to type our favorite book quotations into, which we will then store in our MySQL database.

Getting ready

This recipe will build on the MySQL database and tables we created in previous recipes.

How to do it…

We will insert, retrieve, and modify our favorite quotations using our Python GUI. We have refactored the MySQL tab of our GUI in preparation for this.

In order to make the buttons do something, we will connect them to callback functions, as we did in previous recipes.

We will display the data in the ScrolledText widget below the buttons.

In order to do this, we will import the MySQL.py module, as we did before...