O'Reilly logo

Tkinter GUI Programming by Example by David Love

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating new endpoints

The first thing we will need is the ability to select new messages from our conversation databases. We will need to provide the current user's username and the last time when we checked for messages. Our database will then return all new messages by a different author since the last time we checked for messages.

Open up your conversation.py file and add the following method to it:

def get_new_messages(self, timestamp, username):    sql = "SELECT author, message FROM conversation WHERE date_sent > ? AND author <> ?"    params = (timestamp, username)    conn = sqlite3.connect(self.database)    conn.row_factory = sqlite3.Row    cursor = conn.cursor()    cursor.execute(sql, params)    results = [dict(row) for row in cursor.fetchall()] conn.close() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required