I've a problem with wx.ListCtrl and MySQLdb

Hi,

My name is Esdras DAYIRI, I’m a ivorian student begining with python(and wxpython). I need your help about wx.ListCtrl and Mysqldb queries. I’ve a frame with some controls all connected to a Mysqldb database. But my aim is that:

  • when i’m click on the button “add”, after inserting data in the database, datas must be shown in the list and when I choose a line in the listctrl, i’d like that the information of this line appear in the form (the list and the other objects are on the same form) and must be edited or deleted.

I hope to read you soon
Thank’s

ESDRAS DAYIRI

···

Envoyé avec Yahoo! Mail.
Une boite mail plus intelligente.

Hi,

dayiri esdras wrote:

Hi,

My name is Esdras DAYIRI, I'm a ivorian student begining with python(and wxpython). I need your help about wx.ListCtrl and Mysqldb queries. I've a frame with some controls all connected to a Mysqldb database. But my aim is that:

- when i'm click on the button "add", after inserting data in the database, datas must be shown in the list and when I choose a line in the listctrl, i'd like that the information of this line appear in the form (the list and the other objects are on the same form) and must be edited or deleted.

I am currently testing the objectlistview (as a replacement for the standard wx.ListCtrl in my application), you can find it here: ObjectListView — ObjectListView v1.2 documentation

My database access is done using sqlalchemy (http://www.sqlalchemy.org/ - currently I use 0.4.5).

For my testing I started creating a small script to see how I can manipulate the list etc, and this does part of what you would like to do.

model.py - the database schema definition
objectlistviewTest.py - the script

I normally use Firebird SQL, but I changed the script a little bit so it can use sqlite (included with Python 2.5) as the db. This also shows you how easy it is to change from one db to another one with sqlalchemy.

The script will load some test data into a sqlite database and then display the data in a listview, when you click on an item the data is then loaded into two textctrl's using validators.

It does not handle the adding or changing of the data. You could either change the listctrl to allow the user to change in side the listctrl or add some buttons to add and save data from the textctrls.

Hope this is helpful and gets you going
Werner

model.py (4.47 KB)

objectlistviewTest.py (6.39 KB)