Re: Tkinter callback arguments

2009-11-04 Thread Gabriel Genellina
En Wed, 04 Nov 2009 04:50:42 -0300, Alf P. Steinbach al...@start.no 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

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 al...@start.no 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

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,

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

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 stated

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

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

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

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 members

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 Gabriel Genellina
En Wed, 04 Nov 2009 03:15:14 -0300, Alf P. Steinbach al...@start.no 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

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 a larger

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

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 naming

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 first Python class so

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

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 that there are all

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 that there are all

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

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

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` restricts your choices if

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

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 data

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 people

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

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.

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

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.

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):

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