FW: Event not playing right

FW: Event not playing right
I found it. After looking at the code for 24 hours, I finally was able to see that I didn’t use the parentheses after the event.IsChecked. It is funny how that kind of thing can be hard to see.

–vicki

···

-----Original Message-----
**From: ** Stanfield, Vicki {D167~Indianapolis}
**Sent: ** Tuesday, July 27, 2004 10:51 AM
**To: ** Stanfield, Vicki {D167~Indianapolis}
**Subject: ** RE: Event not playing right

I can not figure out why the if/elif for this checkbox doesn’t work. The event gets triggered when the box is checked or unchecked, but I can’t seem to read the value back. I am not good enough at debugging in Python to determine what event.IsChecked is actually set to. I tried a print statement and nothing showed up, so I suppose the event.IsChecked is NULL right now. But why? I do almost the exact same thing with a toggle button elsewhere in the code, and it works fine. Can anyone see what I am missing or suggest some way to find out why the if isn’t getting triggered?

–vicki

-----Original Message-----
**>From: ** Stanfield, Vicki {D167~Indianapolis}
**>Sent: ** Monday, July 26, 2004 12:22 PM
**>To: ** ‘wxPython-users@lists.wxwidgets.org’
**>Subject: ** Event not playing right

I have created a checkbox:

   #Add a Checkbox to determine whether or not to loop

through input file

   self.Reiterate = wx.CheckBox(self, -1,

label=‘Reiterate through input file?’)

   wx.EVT_CHECKBOX(self, -1, self.UpdateLooping)

I want to get the status from it, and set a variable, but for

some reason, it isn’t working.

def UpdateLooping(self,event):

   print "Got here."
   if event.IsChecked == wx.FALSE:
       STOP_READ = wx.TRUE
       print "STOP_READ set to TRUE"
   elif event.IsChecked == wx.TRUE:
       STOP_READ = wx.FALSE
       print "STOP_READ set to FALSE"

I get the “Got here.” with no problem, but the status of the

Checkbox isn’t coming through and I’m not getting into the if

statement regardless of whether or not the box is checked. I

have done similar things with other widgets with no problem.

What am I doing wrong here?

Vicki Stanfield

3S Confidence Meter Project

"A pessimist sees the difficulty in every opportunity; an

optimist sees the opportunity in every difficulty."

– Winston Churchill