listbox - Traverse through a wxListBox in Python -
I have this static method that replaces the characters in a string:
@ Staticmethod def reverse (s): TCTT = '' in the range for I (lane -1, -1, -1): TSTT = S [i] Return TST I have A wxListBox filled with different strings. I need to cross through wxListBox and apply my reverse method to each reverse: [self.listBox1.GetString (i) in the category (self.listBox1 .GetCount ())]: Self. The above code is not rolling back my string, but I'm sure my reverse method works. How do I apply my reverse method to each string within the wxListBox?
Your code works perfectly :-) It turns the wire, but that's it. If you want to see the referenced strings in the listback, then you have to update the list order. It all goes around the fact that the strings are immutable, and in your reverse you actually return a new string (reverse) but there is no command to put the string back in the listboxes. Therefore, something like this should be done:
for the category (self.listBox1.GetCount ()): self.listBox.SetString (i, self.reverse (self.listBox1. GetString (I)))
Comments
Post a Comment