Hi Werner,
Thanks for your help.
I now get “TypeError: cannot concatenate ‘str’ and ‘int’ objects”, which is perhaps just a python thing, but can you help?
def OnGenerate(self, event):
Name_Number=self.rb.GetItemLabel(event.GetInt())
Name_Number = xrange(int(raw_input("Choose number of Names (1-20)? "))) # I had been using this
state = [None,None]
Name_List = []
tmp = choice(((‘bob’, ‘mary’),(‘joe’, ‘rita’),(‘vera’, ‘john’),(‘gail’, ‘sue’)))
for x in Name_Number:
print ‘state’,state
print ‘tmp1’,tmp
while tmp in state[0:2]: #or for x in range(2):
tmp = choice(nextName[Name_List[-1]])
print ‘tmp2’,tmp
print "Name “,x+1,” is ", tmp
Name_List.append(tmp)
state[x%2] = tmp
print Name_List
So, I tried this;
Name_Number=xrange(int(self.rb.GetString()))
But got this;
TypeError: RadioBox_GetString() takes exactly 2 arguments (1 given)
Help!
Thanks,
Malcolm
···
Hi Malcolm,
Malcolm Clift wrote:
Hi Werner,
Thanks for your help.
I now get "TypeError: cannot concatenate 'str' and 'int' objects", which is perhaps just a python thing, but can you help?
def OnGenerate(self, event):
Name_Number=self.rb.GetItemLabel(event.GetInt())
# Name_Number = xrange(int(raw_input("Choose number of Names (1-20)? "))) # I had been using this
"raw_input" returns a string which you are trying to convert to an integer with "int"
state = [None,None]
Name_List =
tmp = choice((('bob', 'mary'),('joe', 'rita'),('vera', 'john'),('gail', 'sue')))
for x in Name_Number:
print 'state',state
print 'tmp1',tmp
while tmp in state[0:2]: #or for x in range(2):
tmp = choice(nextName[Name_List[-1]])
print 'tmp2',tmp
print "Name ",x+1," is ", tmp
Name_List.append(tmp)
state[x%2] = tmp
print Name_List
Name_Number=xrange(int(self.rb.GetString()))
GetString requires an "int" - i.e. the selected position, what about just:
Name = self.rb.GetString(self.rb.GetSelection())
But got this;
TypeError: RadioBox_GetString() takes exactly 2 arguments (1 given)
Help!
Malcolm
See you
Werner
P.S. if you still have a problem can you post a small sample which one can run and see what you are trying to do.