As I struggled to learn the wxListCtrl, i created a new version of the wxListCtrl.py demo code to test:
- starting with an empty list
- loading several items in the list
- inserting one item in the list
- deleting an item from the list
- adjusting column width with an empty list or a list with data
I tried to keep it as simple as possible to remain close to the original wxListCtrl demo code.
I am planning to check it in cvs but running out of time for today. I still need to check if the code complies with the source code guidelines.
I though i would just post the new file in here for now and request comments from anyone willing to take a look. To use it inside the demo simply edit the demo Main.py and add wxListCtrl_1 beside wxListCtrl at line 78.
My goal when i wrote this update demo module was to show how to handle the wxListCtrl and answer all the questions I asked on this list the last couple of days.
Please reply with any suggestions and criticism that are appropriate. I will update the code and check it into cvs later this week if the response is positive.
The file wxListCtrl_1.py is attached inside demo1.zip
Hope this helps and thansk to everyone that replied to my newbie questions.
Regards,
Pierre
demo1.zip (9.01 KB)
Pierre,
Pierre Rouleau wrote:
As I struggled to learn the wxListCtrl, i created a new version of the wxListCtrl.py demo code to test:
- starting with an empty list
- loading several items in the list
- inserting one item in the list
- deleting an item from the list
- adjusting column width with an empty list or a list with data
I tried to keep it as simple as possible to remain close to the original wxListCtrl demo code.
I am planning to check it in cvs but running out of time for today. I still need to check if the code complies with the source code guidelines.
I though i would just post the new file in here for now and request comments from anyone willing to take a look. To use it inside the demo simply edit the demo Main.py and add wxListCtrl_1 beside wxListCtrl at line 78.
My goal when i wrote this update demo module was to show how to handle the wxListCtrl and answer all the questions I asked on this list the last couple of days.
Please reply with any suggestions and criticism that are appropriate. I will update the code and check it into cvs later this week if the response is positive.
The file wxListCtrl_1.py is attached inside demo1.zip
I had a look at it, and here are my first impressions:
- Would add a button for the Load function. I am not one to read documentation and I had to search a little to figure out how to get data into the list.
- Due to your other mail I reworked my code to maintain the itemDataMap, it seems to do the trick and is more straight forward, but it might do more work then necessary in some cases, and in your demo you would have to at least add a key to the additional data..
self.itemDataMap.clear()
self.itemDataMap.update(self.dataDict)
In my case the self.dataDict contains the new data which is loaded through a validator from my database and the key is equal to the primary key (e.g. {1532: 'db column 1', 'db column n'}.
Pitty that you didn't do this a few month ago
it would have saved me some days! Haven't done any of this right mouse menu stuff in my application but will do at some point at which time I will sure remember to have another look at this demo.
Hope this helps and thansk to everyone that replied to my newbie questions.
Regards,
Pierre
See you
Werner
Werner F. Bruhin wrote:
Pierre,
Pierre Rouleau wrote:
As I struggled to learn the wxListCtrl, i created a new version of the wxListCtrl.py demo code to test:
- starting with an empty list
- loading several items in the list
- inserting one item in the list
- deleting an item from the list
- adjusting column width with an empty list or a list with data
I tried to keep it as simple as possible to remain close to the original wxListCtrl demo code.
I am planning to check it in cvs but running out of time for today. I still need to check if the code complies with the source code guidelines.
I though i would just post the new file in here for now and request comments from anyone willing to take a look. To use it inside the demo simply edit the demo Main.py and add wxListCtrl_1 beside wxListCtrl at line 78.
My goal when i wrote this update demo module was to show how to handle the wxListCtrl and answer all the questions I asked on this list the last couple of days.
Please reply with any suggestions and criticism that are appropriate. I will update the code and check it into cvs later this week if the response is positive.
The file wxListCtrl_1.py is attached inside demo1.zip
I had a look at it, and here are my first impressions:
- Would add a button for the Load function. I am not one to read documentation and I had to search a little to figure out how to get data into the list.
Agreed, i figured that a demo showing nothing at first might be a little scary and was planning to do something about it.
- Due to your other mail I reworked my code to maintain the itemDataMap, it seems to do the trick and is more straight forward, but it might do more work then necessary in some cases, and in your demo you would have to at least add a key to the additional data..
self.itemDataMap.clear()
self.itemDataMap.update(self.dataDict)
The key is created when the extra data is inserted in musicdata. I'll look at it some more and will try to make it clearer.
In my case the self.dataDict contains the new data which is loaded through a validator from my database and the key is equal to the primary key (e.g. {1532: 'db column 1', 'db column n'}.
Pitty that you didn't do this a few month ago
it would have saved me some days! Haven't done any of this right mouse menu stuff in my application but will do at some point at which time I will sure remember to have another look at this demo.
Glad it helped and thanks for the comments.
Pierre
Hi Pierre,
Another little thing to add to the new demo?
Took me some time to figure out how to programmatically unselect an item, selecting is in the demo, but not have to unselect.
Updated the listctrl WIKI, but you might want to update your demo.
See you
Werner
Pierre Rouleau wrote:
···
As I struggled to learn the wxListCtrl, i created a new version of the wxListCtrl.py demo code to test:
- starting with an empty list
- loading several items in the list
- inserting one item in the list
- deleting an item from the list
- adjusting column width with an empty list or a list with data
I tried to keep it as simple as possible to remain close to the original wxListCtrl demo code.
I am planning to check it in cvs but running out of time for today. I still need to check if the code complies with the source code guidelines.
I though i would just post the new file in here for now and request comments from anyone willing to take a look. To use it inside the demo simply edit the demo Main.py and add wxListCtrl_1 beside wxListCtrl at line 78.
My goal when i wrote this update demo module was to show how to handle the wxListCtrl and answer all the questions I asked on this list the last couple of days.
Please reply with any suggestions and criticism that are appropriate. I will update the code and check it into cvs later this week if the response is positive.
The file wxListCtrl_1.py is attached inside demo1.zip
Hope this helps and thansk to everyone that replied to my newbie questions.
Regards,
Pierre
------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org