Just moozing

Before you can check your notes, you must make them…

wxPython, databases and multithreading

leave a comment »

I am doing a project where I have a data acquisition thread that dump data into an Sqlite database. To make it more useful, I wanted to auto update a wxPython listctrl. Not trivial, so I made a class to handle it. 

On my github page, I created a project called wxListCtrlDb. It handles all the stuff related to the multithreading part and updates the listctrl based on the database cursor. I made it to be easy to use.

The result is as shown on the screendump. The rows in the listctrl comes directly from the select statement that returns the data.

In order to use it, the wxListCtrlDb.py is the only one needed. The test directory contains the wxRunme.py test file and some database support stuff.

BTW, the GUI itself is done with wxGlade and I inherit from the generated code to implement the OnClick callback. It works well for me.

I have tried to do a bit of commenting in the file 🙂 If you find it useful, tell me and if you find any issues, use the github issue tracker.


Written by moozing

August 9, 2012 at 09:00

Posted in Tech

Tagged with , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: