Re: Tkinter callback arguments

2009-11-04 Thread Alf P. Steinbach
* Alf P. Steinbach: * Steven D'Aprano: On Wed, 04 Nov 2009 08:50:42 +0100, Alf P. Steinbach wrote: * Gabriel Genellina: I don't understand either. R1 and R2 have *different* semantics. Assume that they have the very exact same semantics Why would we assume that when you have explicitly t

Re: Tkinter callback arguments

2009-11-04 Thread Alf P. Steinbach
* Steven D'Aprano: On Wed, 04 Nov 2009 08:50:42 +0100, Alf P. Steinbach wrote: * Gabriel Genellina: I don't understand either. R1 and R2 have *different* semantics. Assume that they have the very exact same semantics Why would we assume that when you have explicitly told us that they don'

Re: Tkinter callback arguments

2009-11-04 Thread Steven D'Aprano
On Wed, 04 Nov 2009 08:50:42 +0100, Alf P. Steinbach wrote: > * Gabriel Genellina: >> >> I don't understand either. R1 and R2 have *different* semantics. > > Assume that they have the very exact same semantics Why would we assume that when you have explicitly told us that they don't? You st

Re: Tkinter callback arguments

2009-11-04 Thread Alf P. Steinbach
* Terry Reedy: Alf P. Steinbach wrote: However, the natural semantics is that various logical properties, such as left, top, right, bottom, width and height, can be varied independently. But they *CANNOT* be varied independently. A rectangle with side parallel to the axes has exactly 4 degr

Re: Tkinter callback arguments

2009-11-04 Thread Terry Reedy
Alf P. Steinbach wrote: However, the natural semantics is that various logical properties, such as left, top, right, bottom, width and height, can be varied independently. But they *CANNOT* be varied independently. A rectangle with side parallel to the axes has exactly 4 degress of freedom, n

Re: Tkinter callback arguments

2009-11-04 Thread Alf P. Steinbach
* Gabriel Genellina: En Wed, 04 Nov 2009 04:50:42 -0300, Alf P. Steinbach escribió: * Gabriel Genellina: I don't understand either. R1 and R2 have *different* semantics. Assume that they have the very exact same semantics -- like two TV sets that look the same and work the same except

Re: Tkinter callback arguments

2009-11-04 Thread Gabriel Genellina
En Wed, 04 Nov 2009 04:50:42 -0300, Alf P. Steinbach escribió: * Gabriel Genellina: I don't understand either. R1 and R2 have *different* semantics. Assume that they have the very exact same semantics -- like two TV sets that look the same and work the same except when you open 'em up

Re: Tkinter callback arguments

2009-11-03 Thread Alf P. Steinbach
* Gabriel Genellina: I don't understand either. R1 and R2 have *different* semantics. Assume that they have the very exact same semantics -- like two TV sets that look the same and work the same except when you open 'em up and poke around in there, oh holy cow, in this one there's stuff th

Re: Tkinter callback arguments

2009-11-03 Thread Peter Otten
Alf P. Steinbach wrote: > * Peter Otten: >> * Alf P. Steinbach wrote: >>> * Peter Otten: Every time someone has to read the code he will read, hesitate, read again, and then hopefully come to the conclusion that the code does nothing, consider not using it, or if it is not tied into

Re: Tkinter callback arguments

2009-11-03 Thread Gabriel Genellina
En Wed, 04 Nov 2009 03:15:14 -0300, Alf P. Steinbach escribió: * Steven D'Aprano: On Wed, 04 Nov 2009 02:29:21 +0100, Alf P. Steinbach wrote: For example, consider two rectangle classes R1 and R2, where R2 might be a successor to R1, at some point in system evolution replacing R1. R1 has log

Re: Tkinter callback arguments

2009-11-03 Thread Alf P. Steinbach
* Steven D'Aprano: On Wed, 04 Nov 2009 02:29:21 +0100, Alf P. Steinbach wrote: For example, consider two rectangle classes R1 and R2, where R2 might be a successor to R1, at some point in system evolution replacing R1. R1 has logical data members left, top, width and height, and R2 has logical

Re: Tkinter callback arguments

2009-11-03 Thread Steven D'Aprano
On Wed, 04 Nov 2009 02:29:21 +0100, Alf P. Steinbach wrote: >>> For example, consider two rectangle classes R1 and R2, where R2 might >>> be a successor to R1, at some point in system evolution replacing R1. >>> R1 has logical data members left, top, width and height, and R2 has >>> logical data m

Re: Tkinter callback arguments

2009-11-03 Thread Alf P. Steinbach
* Diez B. Roggisch: Alf P. Steinbach schrieb: * Diez B. Roggisch: Your comment about "computed" makes it more clear what that's all about. Also Bertrand Meyer (Eiffel language creator) had idea like that, he called it "referential transparency". But I think when Python has this nice property m

Re: Tkinter callback arguments

2009-11-03 Thread Diez B. Roggisch
> Your comment about "computed" makes it more clear what that's all about. > Also Bertrand Meyer (Eiffel language creator) had idea like that, he > called it "referential transparency". But I think when Python has this > nice property mechanism, why do people change direct data attributes into > pr

Re: Tkinter callback arguments

2009-11-02 Thread Alf P. Steinbach
* Peter Otten: * Alf P. Steinbach wrote: * Peter Otten: Every time someone has to read the code he will read, hesitate, read again, and then hopefully come to the conclusion that the code does nothing, consider not using it, or if it is not tied into a larger project removing it. I don't under

Re: Tkinter callback arguments

2009-11-02 Thread Diez B. Roggisch
Alf P. Steinbach schrieb: * Diez B. Roggisch: Your comment about "computed" makes it more clear what that's all about. Also Bertrand Meyer (Eiffel language creator) had idea like that, he called it "referential transparency". But I think when Python has this nice property mechanism, why do peopl

Re: Tkinter callback arguments

2009-11-02 Thread Peter Otten
Alf P. Steinbach wrote: > * Peter Otten: >> Alf P. Steinbach wrote: >> >>> * Peter Otten: Alf P. Steinbach wrote: >> for x in range(0,3): >> Button(.., command=lambda x=x: function(x)) > An alternative reusable alternative is to create a button-with-id >

Re: Tkinter callback arguments

2009-11-02 Thread Mel
Alf P. Steinbach wrote: > Your comment about "computed" makes it more clear what that's all about. > Also Bertrand Meyer (Eiffel language creator) had idea like that, he > called it "referential transparency". But I think when Python has this > nice property mechanism, why do people change direct d

Re: Tkinter callback arguments

2009-11-02 Thread Alf P. Steinbach
* Diez B. Roggisch: Your comment about "computed" makes it more clear what that's all about. Also Bertrand Meyer (Eiffel language creator) had idea like that, he called it "referential transparency". But I think when Python has this nice property mechanism, why do people change direct data attrib

Re: Tkinter callback arguments

2009-11-02 Thread Mel
Alf P. Steinbach wrote: > * Peter Otten: >> Alf P. Steinbach wrote: >>> * Peter Otten: unidiomatic None-checks >>> What's the idiomatic Python way for an optional thing? >> >> if some_value is None: ... > > Thanks! > > But why is this preferred? I guess because `some_value == None` restric

Re: Tkinter callback arguments

2009-11-02 Thread Alf P. Steinbach
* Diez B. Roggisch: Alf P. Steinbach wrote: * Peter Otten: Alf P. Steinbach wrote: for x in range(0,3): Button(.., command=lambda x=x: function(x)) An alternative reusable alternative is to create a button-with-id class. This is my very first Python class so I'm guessing th

Re: Tkinter callback arguments

2009-11-02 Thread Alf P. Steinbach
* Peter Otten: Alf P. Steinbach wrote: * Peter Otten: Alf P. Steinbach wrote: for x in range(0,3): Button(.., command=lambda x=x: function(x)) An alternative reusable alternative is to create a button-with-id class. This is my very first Python class so I'm guessing that th

Re: Tkinter callback arguments

2009-11-02 Thread Diez B. Roggisch
Alf P. Steinbach wrote: > * Peter Otten: >> Alf P. Steinbach wrote: >> for x in range(0,3): Button(.., command=lambda x=x: function(x)) >>> An alternative reusable alternative is to create a button-with-id class. >>> >>> This is my very first Python class so I'm guessing

Re: Tkinter callback arguments

2009-11-02 Thread Peter Otten
Alf P. Steinbach wrote: > * Peter Otten: >> Alf P. Steinbach wrote: >> for x in range(0,3): Button(.., command=lambda x=x: function(x)) >>> An alternative reusable alternative is to create a button-with-id class. >>> >>> This is my very first Python class so I'm guessing

Re: Tkinter callback arguments

2009-11-02 Thread Alf P. Steinbach
* Peter Otten: Alf P. Steinbach wrote: for x in range(0,3): Button(.., command=lambda x=x: function(x)) An alternative reusable alternative is to create a button-with-id class. This is my very first Python class so I'm guessing that there are all sorts of issues, in particular

Re: Tkinter callback arguments

2009-11-02 Thread Brian J Mingus
On Mon, Nov 2, 2009 at 2:26 AM, Peter Otten <__pete...@web.de> wrote: > Alf P. Steinbach wrote: > > >> for x in range(0,3): > >> Button(.., command=lambda x=x: function(x)) > > > > An alternative reusable alternative is to create a button-with-id class. > > > > This is my very firs

Re: Tkinter callback arguments

2009-11-02 Thread Peter Otten
Alf P. Steinbach wrote: >> for x in range(0,3): >> Button(.., command=lambda x=x: function(x)) > > An alternative reusable alternative is to create a button-with-id class. > > This is my very first Python class so I'm guessing that there are all > sorts of issues, in particular n

Re: Tkinter callback arguments

2009-11-02 Thread eb303
On Nov 1, 8:53 pm, Lord Eldritch wrote: > Hi > > Maybe this is maybe something it has been answered somewhere but I haven't > been able to make it work. I wanna pass one variable to a callback function > and I've read the proper way is: > > Button(.., command=lambda: function(x)) > > So with >

Re: Tkinter callback arguments

2009-11-01 Thread Lord Eldritch
Alf P. Steinbach wrote: > * MRAB: Thank you all! It is working now nicely! God! I love usenet..:D -- Lord Eldritch -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter callback arguments

2009-11-01 Thread Alf P. Steinbach
* MRAB: Lord Eldritch wrote: Hi Maybe this is maybe something it has been answered somewhere but I haven't been able to make it work. I wanna pass one variable to a callback function and I've read the proper way is: Button(.., command=lambda: function(x)) So with def function(a): prin

Tkinter callback arguments

2009-11-01 Thread Lord Eldritch
Hi Maybe this is maybe something it has been answered somewhere but I haven't been able to make it work. I wanna pass one variable to a callback function and I've read the proper way is: Button(.., command=lambda: function(x)) So with def function(a): print a I get the value of x. Ok. My

Re: Tkinter callback arguments

2009-11-01 Thread MRAB
Lord Eldritch wrote: Hi Maybe this is maybe something it has been answered somewhere but I haven't been able to make it work. I wanna pass one variable to a callback function and I've read the proper way is: Button(.., command=lambda: function(x)) So with def function(a): print a I ge

Tkinter callback arguments

2009-11-01 Thread Lord Eldritch
Hi Maybe this is maybe something it has been answered somewhere but I haven't been able to make it work. I wanna pass one variable to a callback function and I've read the proper way is: Button(.., command=lambda: function(x)) So with def function(a): print a I get the value of x. Ok. My