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] event_generate question

2009-01-29 Thread Guilherme Polo
On Thu, Jan 29, 2009 at 2:24 PM, Allen Taylor wrote: > Hello Guilherme, >> >>> Guilherme Polo 2009-01-28 18:18 >>> >> On Wed, Jan 28, 2009 at 7:54 PM, Allen Taylor >> wrote: >> > I'm trying to generate some events in Tkinter but it doesn't seem to be >> > working the way I expected. Here's an ex

Re: [Tkinter-discuss] event_generate question

2009-01-29 Thread Allen Taylor
Hello Guilherme, > >>> Guilherme Polo 2009-01-28 18:18 >>> > On Wed, Jan 28, 2009 at 7:54 PM, Allen Taylor > wrote: > > I'm trying to generate some events in Tkinter but it doesn't seem to be > > working the way I expected. Here's an example of what I'm trying to do... > > > > def click(): > >