Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 9th, 2005, 7:20 AM   #1
Dietrich
Professional Programmer
 
Dietrich's Avatar
 
Join Date: Feb 2005
Posts: 434
Rep Power: 4 Dietrich is on a distinguished road
Smile Sorting a wxListBox

Is there a sorted feature built into the wxListBox, or does it have to be done externally? Can't find anything in the poorly written manual.
__________________
I looked it up on the Intergnats!
Dietrich is offline   Reply With Quote
Old Aug 9th, 2005, 7:33 AM   #2
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,886
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
I don't know wxpython, but you could try going

dir(wxListBox)

and see if you see anything along the lines of 'sort'

or you could try help(wxListBox) or help(wxPython)

That's all I can help.
Sane is offline   Reply With Quote
Old Aug 9th, 2005, 8:11 AM   #3
dannyp
Newbie
 
Join Date: Jul 2005
Location: Philadelphia, PA
Posts: 11
Rep Power: 0 dannyp is on a distinguished road
I did it like this,

self.commandList = {'Channel Up': 'c+', 'Channel Down': 'c-', 'Vol Up': 'v+', 'Vol Down': 'v-', 'Guide': 'g', 'Settings': 's',
                      'Select': 'sel', 'Page Up': 'p+', 'Page Down': 'p-', 'Mute': 'm', 'A Key': 'A', 'B Key': 'B', 'C Key': 'C', 
                      'Up Arrow': 'u', 'Down Arrow': 'd', 'Left Arrow': 'l', 'Right Arrow': 'r', 'Info': 'i', 'Exit': 'e','Launch Diags': 'launch', 'Channel #': '#'}
        
self.choices = self.commandList.keys()
self.choices.sort()

self.listbox = wx.ListBox(self, -1, (120, 50), (90, 120), self.choices, wx.LB_SINGLE)
self.Bind(wx.EVT_LISTBOX, self.EvtListBox, self.listbox)

Basically sort the list before you put it in the ListBox.
dannyp is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:05 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC