Makeing a constant ??
barmeier at barmeier.com
Fri Mar 17 13:48:11 CET 2000
On Fri, 17 Mar 2000 11:20:35 +0100, "Dinu C. Gherman"
<gherman at darwin.in-berlin.de> wrote:
>Matthias Barmeier wrote:
>> In a funtion call I have to use a constant as one of the parameters.
>> I want this constant to be created on the fly depending on some user
>> Is it possible in Python to "make" a constant !?
>I guess this is too vague a description of what you need.
>Could you rephrase it or give a code example of what you
>expect to be able to do?
I have a function that needs to be called like:
What I want todo is to replace this:
The function I want to use is the tkinter function bind with an
expression Frederik Lundh send me.
This expression looks like this:
widget.bind(itemName, lambda e, cb=self.driveEvent:
The second itemName in this expression is my problem.
When the event is fired I always get the message that itemName is
When I use this instead:
widget.bind(itemName, lambda e, cb=self.driveEvent: cb(e,
everything works fine.
For me (and I am absolute newbie to Python) it looks like TkInter
expects a constant expression. My problem is I dont want to write
the constant in the code. I want to produce the constant after reading
an config file.
I hope this more clear now, and that you have a hint for me.
More information about the Python-list