[Tutor] i know this should be easy

Jeremy Jones zanesdad at bellsouth.net
Wed Aug 17 16:16:47 CEST 2005


nephish wrote:

>Hey there,
>i have a simple question.
>if something returns a true or false, how do i test for it with an if 
>statement?
>i am using pygtk with a toggle button that returns TRUE if checked and 
>FALSE if not.
>do i need quotes around the TRUE / FALSE or should i use 1 and 0?
>
>Auto_Tog = self.AutoCheckRaw.get_active()
>if str(AddDay_Tog)== '1':
>    do so and so.
>  
>
If ``get_active()`` returns True or False (or 1 or 0), you could just do::

    if self.AutoCheckRaw.get_active():
       do_your_True_stuff_here()
    else:
       do_your_False_stuff_here()


>is this right?
>
>thanks
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>  
>
Jeremy


More information about the Tutor mailing list