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 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() ...
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