hi. <br><br>i am trying to learn event binding. i have a form with a couple of buttons for different tags, which all call the same function. the text on the buttons changes from record to record. this is the problem area:<br>
<br> def showrecords(self):<br> """this function updates the form labels to show the current record"""<br> global gmax<br> global gctr<br> global CurrTitle
<br> global CurrAuthor<br> global CurrTag1<br> global CurrTag2<br> global CurrTag3<br> global CurrTag4<br> global CurrTag5<br> global CurrAbstract<br> global CurrLocation
<br> global CurrID<br> global HuntFor<br><br> self.Lbn.config(text=gmax)<br> self.Lbnof.config(text=gctr+1)<br> self.LbTitle.config(text=CurrTitle, justify=LEFT)<br> self.LbName.config
(text=CurrAuthor)<br> self.LbPath.config(text=CurrLocation)<br> self.BtTag1.bind('<Button-1>',self.calltotags(tag=CurrTag1))<br> self.BtTag1.config(text=CurrTag1)<br> self.BtTag2.bind
('<Button-1>',self.calltotags(tag=CurrTag2))<br> self.BtTag2.config(text=CurrTag2)<br> self.BtTag3.bind('<Button-1>',self.calltotags(tag=CurrTag3))<br> self.BtTag3.config(text=CurrTag3)
<br> self.BtTag4.bind('<Button-1>',self.calltotags(tag=CurrTag4))<br> self.BtTag4.config(text=CurrTag4)<br> self.BtTag5.bind('<Button-1>',self.calltotags(tag=CurrTag5))
<br> self.BtTag5.config(text=CurrTag5)<br> self.LbAbs.config(text=CurrAbstract)<br><br> def calltotags(event, tag):<br> # This function sets the search variable HuntFor value, and calls the tagwork class.
<br> global HuntFor<br> global toggle<br> HuntFor=tag <br> toggle="Tagcluster"<br> print HuntFor<br> tagwork()<br><br>when i click on the buttons, none of them call the function. i only see the huntfor value in the prompt when i load the program. can someone please enlighten me as to why this happens? (the buttons are loaded on the root window in an earlier function, and i have the same problem even if i try binding the events there)
<br><br>also, can someone suggest a good (and free!) code editor for python please? <br><br>thanks in advance. <br>mridula.<br>