On 03/03/17 20:59, Pooja Bhalode wrote: > I tried putting in the event handlers for the checkbuttons as shown below. > > num = 0 > def selfcheck(event): > print "Self Check" > num = num + 1 > if num == 2:
You need num to be inside the function since it needs to be reset to zero on every check. And the increment should only be if the button is checked. Something like(untested pseudo-code) def selfcheck(evt): num = 0 for butt in [butt1,butt2,butt3,butt4]: if butt.isChecked: num += 1 if num == 2 for butt in [butt1,butt2,butt3,butt4]: if not butt.isChecked: butt.disable() else: # if a button is unchecked, re-enable all for butt in [butt1,butt2,butt3,butt4]: butt.enable() You then need to bind that to the mouse click event for each button. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor