From: <bra...@om...> - 2005-03-15 22:02:10
|
I'd like to capture the line number the user doubleclicks in a multiColumnList. I guess this would happen on the event "itemActivated", but what is the name of the method that returns the line number selected by the user? I didn't see anything in the source code for class MultiColumnList. I looked a the docs for wxListCtrl, but didn't see any help there either. Hints? Thanks! |
From: Liam C. <cy...@gm...> - 2005-03-16 01:59:21
|
Hi Brad, for a multicolumnlist called MCL, because I'm boring - def on_MCL_itemActivated(self, event): wasSelected = self.components.MCL.getStringSelection()[0] will return the list(line) that was clicked on. To get an actual index for it, use - def on_MCL_itemActivated(self, event): selectedIndex = event.m_itemIndex I trawled through the wxPython multicolumnlist demo code to find that. Remember, 90% of the wxPython tricks you need are in the demo, it's just the knack of finding them. Only reason I found that is I noticed that when you click an item in that demo it prints stuff like this - OnItemSelected: 5, Billy Joel, Blonde Over Blue, Rock So yeah... good luck, Pythoncard is great, and very flexible, and it's not that often you have to revert to the wx stuff. HTH Liam Clarke -- 'There is only one basic human right, and that is to do as you damn well please. And with it comes the only basic human duty, to take the consequences. |
From: <bra...@om...> - 2005-03-16 03:24:55
|
> def on_MCL_itemActivated(self, event): > selectedIndex = event.m_itemIndex Aha! Thanks. That is what I needed. > that demo it prints stuff like this - > > OnItemSelected: 5, Billy Joel, Blonde Over Blue, Rock I think I missed that because multicolumnexample.py doesn't print out that index. After I did more digging I found it in the minimalList.py, which does print the index. When I went looking for info about MultiColumnList, I didn't think to look in the minimalList sample... > So yeah... good luck, Pythoncard is great, and very flexible, and it's > not that often you have to revert to the wx stuff. Yes, but it's nice to know that you can when you need to. I'm not ready to climb the learning curve for wxPython right now, so yes, this is great. |
From: Liam C. <cy...@gm...> - 2005-03-16 05:06:10
|
Sorry, the wxPython demo is different to the Pythoncard demos. Pythoncard is built on top of wxPython (which is built on top of wx), and sometimes you need to use wxPython methods, either because Pythoncard doesn't cover your need yet, or you want to bend some widget some funny way. http://www.wxpython.org/download.php Download it just for the demo. The wxPython demo covers every wx widget, and is the primary source of python documentation for the wx library. Regards, Liam Clarke On Tue, 15 Mar 2005 21:23:54 -0600, bra...@om... <bra...@om...> wrote: > > > > def on_MCL_itemActivated(self, event): > > selectedIndex = event.m_itemIndex > > Aha! Thanks. That is what I needed. > > > that demo it prints stuff like this - > > > > OnItemSelected: 5, Billy Joel, Blonde Over Blue, Rock > > I think I missed that because multicolumnexample.py doesn't > print out that index. After I did more digging I found it > in the minimalList.py, which does print the index. > When I went looking for info about MultiColumnList, I didn't > think to look in the minimalList sample... > > > So yeah... good luck, Pythoncard is great, and very flexible, and it's > > not that often you have to revert to the wx stuff. > > Yes, but it's nice to know that you can when you need to. I'm not > ready to climb the learning curve for wxPython right now, so > yes, this is great. -- 'There is only one basic human right, and that is to do as you damn well please. And with it comes the only basic human duty, to take the consequences. |
From: <bra...@om...> - 2005-03-20 03:33:43
|
I don't suppose there is a way to accomplish this same goal with a simple dialog.singleChoiceDialog. I did a dir on the result of singleChoiceDialog, but didn't see anything that looked promising. I could work backward by searching the list for the matching string, but that seems kludgy. Thanks... pyt...@li... wrote on 03/15/2005 07:59:15 PM: > Hi Brad, > > > for a multicolumnlist called MCL, because I'm boring - > > def on_MCL_itemActivated(self, event): > wasSelected = self.components.MCL.getStringSelection()[0] > > will return the list(line) that was clicked on. > > To get an actual index for it, use - > > def on_MCL_itemActivated(self, event): > selectedIndex = event.m_itemIndex > > > I trawled through the wxPython multicolumnlist demo code to find that. > Remember, 90% of the wxPython tricks you need are in the demo, it's > just the knack of finding them. > Only reason I found that is I noticed that when you click an item in > that demo it prints stuff like this - > > OnItemSelected: 5, Billy Joel, Blonde Over Blue, Rock > > So yeah... good luck, Pythoncard is great, and very flexible, and it's > not that often you have to revert to the wx stuff. > > > HTH > > Liam Clarke > -- > 'There is only one basic human right, and that is to do as you damn > well please. > And with it comes the only basic human duty, to take the consequences. > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Pythoncard-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pythoncard-users |
From: Liam C. <cy...@gm...> - 2005-03-20 04:56:58
|
Why not just bind each string to a particular function in a dict? On Sat, 19 Mar 2005 21:32:57 -0600, bra...@om... <bra...@om...> wrote: > > I don't suppose there is a way to accomplish this same goal with a simple > dialog.singleChoiceDialog. I did a dir on the result of singleChoiceDialog, > but didn't see anything that looked promising. I could work backward by > searching the list for the matching string, but that seems kludgy. > > Thanks... > > > pyt...@li... wrote on 03/15/2005 07:59:15 > PM: > > > > Hi Brad, > > > > > > for a multicolumnlist called MCL, because I'm boring - > > > > def on_MCL_itemActivated(self, event): > > wasSelected = self.components.MCL.getStringSelection()[0] > > > > will return the list(line) that was clicked on. > > > > To get an actual index for it, use - > > > > def on_MCL_itemActivated(self, event): > > selectedIndex = event.m_itemIndex > > > > > > I trawled through the wxPython multicolumnlist demo code to find that. > > Remember, 90% of the wxPython tricks you need are in the demo, it's > > just the knack of finding them. > > Only reason I found that is I noticed that when you click an item in > > that demo it prints stuff like this - > > > > OnItemSelected: 5, Billy Joel, Blonde Over Blue, Rock > > > > So yeah... good luck, Pythoncard is great, and very flexible, and it's > > not that often you have to revert to the wx stuff. > > > > > > HTH > > > > Liam Clarke > > -- > > 'There is only one basic human right, and that is to do as you damn > > well please. > > And with it comes the only basic human duty, to take the consequences. > > > > > > ------------------------------------------------------- > > SF email is sponsored by - The IT Product Guide > > Read honest & candid reviews on hundreds of IT Products from real users. > > Discover which products truly live up to the hype. Start reading now. > > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > > _______________________________________________ > > Pythoncard-users mailing list > > Pyt...@li... > > https://lists.sourceforge.net/lists/listinfo/pythoncard-users > -- 'There is only one basic human right, and that is to do as you damn well please. And with it comes the only basic human duty, to take the consequences. |