I'm trying to pass an argument to a button click func and encountering an issues.
In short, I am trying to get a button press to pop up out the askColor()
method, and return that colour value as the background colour of the related textbox.
Its function is so synaesthets can associate a colour with a letter/number and record the resulting colour list.
specific lines:
self.boxA = Text(self.mainframe, state='normal', width=3, height=1, wrap='word', background=self.AVal).grid(column=2, row=2, padx=4)
self.boxB = Text(self.mainframe, state='normal', width=3, height=1, wrap='word', background=self.AVal).grid(column=3, row=2, padx=4)
self.boxC = Text(self.mainframe, state='normal', width=3, height=1, wrap='word', background=self.AVal).grid(column=4, row=2, padx=4)
self.ABlob = ttk.Button(self.mainframe, text="A",style= 'mainSmall.TButton', command= lambda: self.getColour(self.boxA)).grid(column=2, row=3)
self.BBlob = ttk.Button(self.mainframe, text="B",style= 'mainSmall.TButton', command= lambda: self.getColour(self.boxB)).grid(column=3, row=3)
self.CBlob = ttk.Button(self.mainframe, text="C",style= 'mainSmall.TButton', command= lambda: self.getColour(self.boxC)).grid(column=4, row=3)
and:
def getColour(self,glyphRef):
(triple, hexstr) = askcolor()
if hexstr:
glyphRef.config(bg=hexstr)
The problem is that I can't seem to reference self.ABlob
in the way I am trying - it returns type None
. I have tried including a pack.forget
command in the button click func, but that also doesn't work.