writing a script to display a lower third for the news, election night is coming up—
it is a long script— but the meat of the issue is toward the end— I am starting up two tkinter buttons and the commands associated with them run automatically---- rather than running the command when I press the button,
the commands they are associated with run but then the buttons are unresponsive.
I initialize my tkinter widgets from the init of the class
it executes the command once and then the buttons are unresponsive, in other words, I am left with the correct text onscreen of the last button created…
I think it has to do with the looping of tkinter and the panda loop, but I am a bit of a newb—
I think a solution might be to make the text changing function a task but I am not having any luck making my buttons load the dictionary data into the onscreen text object—
Below are the pertinent definitions
def super(self,rTit='',PR='',TP='',PcR='',C1='',C1V='',C1P='',TV='',C2='',C2V='',C2P='',C3='',C3V='',C3P='',C4='',C4V='',C4P=''):
defineX()
defineY()
#self.defineKeys()
self.sub1.setText("")
self.sub2.setText("")
self.titleRace.setText(rTit)
self.numTP.setText("Total Precincts: "+TP)
self.numPR.setText("Reporting: "+PR)
self.numPcR.setText("("+PcR+"%)")
self.numTotV.setText("Ballots Cast: "+TV)
self.titleCand1.setText(C1)
self.numC1V.setText(C1V)
self.numC1P.setText("("+C1P+"%)")
self.titleCand2.setText(C2)
self.numC2V.setText(C2V)
self.numC2P.setText("("+C2P+"%)")
if C3:
self.titleCand3.setText(C3)
self.numC3V.setText(C3V)
self.numC3P.setText("("+C3P+"%)")
else:
self.titleCand3.setText(C3)
self.numC3V.setText(C3V)
self.numC3P.setText(C3P)
if C4:
self.titleCand4.setText(C4)
self.numC4V.setText(C4V)
self.numC4P.setText("("+C4P+"%)")
else:
self.titleCand4.setText(C4)
self.numC4V.setText(C4V)
self.numC4P.setText(C4P)
.
.
.
.
def makeLoadFrame(frame):
self.anim1Load=Button(frame, text='Race1',command=self.super(x[0][0],x[0][1],x[0][2],x[0][3],x[0][4],x[0][5],x[0][6],x[0][7],x[1][4],x[1][5],x[1][6]),font='Feisar 10',width=8)
self.anim1Load.grid(row=0,column=0,sticky=W)
self.anim2Load=Button(frame, text='Race2',command=self.super(x[2][0],x[2][1],x[2][2],x[2][3],x[2][4],x[2][5],x[2][6],x[2][7],x[3][4],x[3][5],x[3][6]),font='Feisar 10',width=8)
self.anim2Load.grid(row=2,column=0,sticky=W)
makeLoadFrame(self.frameone)