Newbie question - TclError
bawolk at ucdavis.edu
Wed May 17 10:45:48 EDT 2000
I'm not sure why the example was written as it is, but it won't run. Do
1. Comment out the event.bind(etc...) line.
2. Change "def evaluate(event):" to def evaluate():"
This will work. When you have an indirect binding using "command=", the
callback should not have an argument.
Simon Brunning wrote:
> I've been looking at the 'Getting started with Python' article at
> _p.html>), and I'm having a problem getting one of the examples
> (calc.py) working. The code is as follows:
> from Tkinter import *
> from math import *
> def evaluate(event):
> label['text'] = "Result: " + str(eval(expression.get()))
> frame = Frame(None)
> entry = Entry(frame)
> entry['textvariable'] = expression = StringVar()
> entry.bind("", evaluate)
> label = Label(frame)
> button = Button(frame, text = "Submit", command = evaluate)
> I'm getting the error message 'TclError: no events specified in
> binding'. I've had a hunt round the documentation - if there is an
> answer in there, *I* can't find it.
> Anyone going to take pity on a frustrated newbie?
> Simon Brunning
> TriSystems Ltd.
> sbrunning at trisystems.co.uk
> The opinions expressed are mine, and are not necessarily those of my
> employer. All comments provided "as is" with no warranties of any
> kind whatsoever.
More information about the Python-list