I also dislike lambdas for this purpose. I'd recommend that the original
poster build a class - many ways they could go with this, but here is one
rough sketch (haven't checked for syntax errors, etc.):
class PageButton(Button):
def __init__(self, master, text=None, page_number=0):
On Thu, Jan 29, 2009 at 2:15 PM, wrote:
> With lambda, you need to set the value of the variable at the time the
> lambda is created, or else the variable is grabbed from the environment at
> the time the lambda runs. You can do this by using the variable as a
> default argument. In your case,
With lambda, you need to set the value of the variable at the time the
lambda is created, or else the variable is grabbed from the environment at
the time the lambda runs. You can do this by using the variable as a
default argument. In your case, change:
XT.append(Button(T,text="Viola:New
Ta
On Tue, Jan 27, 2009 at 2:51 PM, vtcodger wrote:
>
> I came across a problem that probably has a simple, clever, answer -- but it
> is eluding me. I was trying to create a set of tab buttons on a Tkinter
> page using Buttons. These are created dynamically when the user loads a
> file. I don't k
I came across a problem that probably has a simple, clever, answer -- but it
is eluding me. I was trying to create a set of tab buttons on a Tkinter
page using Buttons. These are created dynamically when the user loads a
file. I don't know in advance how many files will get opened, so I want to