Skip to Content
Tkinter GUI Programming by Example
book

Tkinter GUI Programming by Example

by David Love
April 2018
Beginner content levelBeginner
340 pages
7h 54m
English
Packt Publishing
Content preview from Tkinter GUI Programming by Example

Creating the Conversation class

Inside your server folder (not the new conversations folder), create a file named conversation.py. This will hold a class of the same name, which handles the sqlite side of creating and interacting with these databases:

import sqlite3class Conversation:    def __init__(self, database):        self.database = database

This looks much like the __init__ method of our Database class, but it will have its SQLite database filename passed to it, allowing this class to work with multiple different conversation databases.

The first method we will need to write is one that will create the table inside the database:

def initialise_table(self):    sql = "CREATE TABLE conversation (author text, message text, date_sent text)" conn = ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Tkinter GUI Application Development Blueprints, Second Edition - Second Edition

Tkinter GUI Application Development Blueprints, Second Edition - Second Edition

Bhaskar Chaudhary

Publisher Resources

ISBN: 9781788627481Supplemental Content