Strange wxChoice.FindString behavior

Rene Aguirre reneaguirre at yahoo.com
Thu Jan 29 16:16:01 EST 2004


Hello everybody,

I had this problem using the FindString funcion of a wxChoice object
on wxPython:
  * I have Windows 98
  * I read a text file edited on a Japanese computer, but only uses
'english' characters.
  * From the file I loaded some strings in some wxChoice object.
  * Later when I wanted to find an string using 'FindString' I never
got a match, even when I say my string, I printed both strings and
look same!, same lenght, same internal coding, so the only way to find
my string is by using:

## my own Find string function, choice is a wxChoice object
def FindString(choice, thestring):
	for i in range(choice.GetCount()):
		txta = choiceDevice.GetString(i)
		if len(txta) != len(thestring):
			continue
		if map(ord, txta) != map(ord, thestring):
			continue
		return i #we have a match
	return -1 #not found

So this is my best solution to something I think should not happen.
Any comments?.

Rene



More information about the Python-list mailing list