Re: [Tkinter-discuss] How to set a constant in lambda

2009-01-29 Thread david . giesen
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):

Re: [Tkinter-discuss] How to set a constant in lambda

2009-01-29 Thread Guilherme Polo
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,

Re: [Tkinter-discuss] How to set a constant in lambda

2009-01-29 Thread david . giesen
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

Re: [Tkinter-discuss] How to set a constant in lambda

2009-01-27 Thread Guilherme Polo
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

[Tkinter-discuss] How to set a constant in lambda

2009-01-27 Thread vtcodger
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