[Tutor] Floating point error in tkinter

Alan Gauld alan.gauld at btinternet.com
Sun Mar 11 01:58:18 CET 2012

On 10/03/12 19:40, Válas Péter wrote:

>     Better to say: I think it is a Tkinter bug (unless we expect Windows
>     to adapt itself to Python), and Tkinter is part of the Python

But it's really a Tcl bug because Tkinter is built on top of Tcl/Tk
and (mostly) cannot fix bugs that exist in the underlying framework.

>         The error message is pretty clear: tkinter is expecting a float, but
>         receiving a string instead.
>     No; it receives a float formatted by Hungarian standards as set in
>     control panel of Windows, and does not recognize it as a float.

No, it is receiving a string - note the quotation marks.
But Tcl is a strange language that interprets many variables
as strings and, especially in Tk, it is common to pass numerical
values as strings. (In early Tcl versions all variables were strings 
interpreted by Tcl at runtime, one of the most common complaints
and a reason for its early lethargy. Nowadays Tcl uses native
types like most other languages and is no longer sloth like...
But some artifacts remain)

Alan G
Author of the Learn to Program web site

More information about the Tutor mailing list