2 questions in wxpython

Larry Bates larry.bates at websafe.com
Wed Dec 5 06:59:47 PST 2007


David Woods wrote:
>>  if(self.combo1.GetValue ==True):
>>        print "%s" % self.combo1.GetValue()
>  
> Here, you're testing for the existence of a method.  You left out the 
> parentheses which get the result of the method call.  And if you'd 
> included the parentheses, you'd be comparing a string result with a Boolean.
>  
> I think:
>  
> if(self.combo1.GetValue() != ''):
>         print "%s" % self.combo1.GetValue()
>  
> might work better.  You might also look at GetSelection() which returns 
> the integer for your selection, if I remember correctly.
> 
> David
> 

Looks like both are written in something other than Python ;-).  In Python:

if self.combo1.GetValue():
     print "%s" % self.combo1.GetValue

-Larry





More information about the wxpython-users mailing list