setting extra data to a wx.textctrl

Pom i.read.the at group.invalid
Thu May 10 23:51:15 EDT 2007


Hello group!


I have an application which uses a lot of mysql data fields, all the 
same data type (floats).

I created a panel which executes a "SELECT * FROM tablename" and makes 
as much fields as needed, using de cursor.description as wx.statictext 
and the cursors field contents copied into wx.textctrls.

At creation time, I loop over all the fields in the record and create a 
tuple which contains ((textctrl1, fieldname1), (textctrl2, fieldname2), 
...)  so I can keep track of which textctrl holds which piece of fielddata.

The problem I'm having is:

to know the fieldname in an text_event, I use event.GetEventObject(), 
then perform an iteration over the tuple and when I find a match I use 
the field name to update the mysqltable.
When having a few fields, this is ok.  But I have over 100 fields in 1 
record and it really slows things down.

Now my question is: should I use a python dictionary (with an object as 
first lookup field) ?

On windows, I've seen a "Tag" property in a textbox which was meant to 
be used for this kind of stuff.  Maybe it's better to override the 
wx.textctrl so I can add an extra string value?


Anyone having the best solution for this ?


thx!



More information about the Python-list mailing list