A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-list/1999-September/018266.html below:

Tkinter "scrollregion" verbosity

Tkinter "scrollregion" verbosityGreg McFarlane gregm at iname.com
Mon Sep 20 01:00:17 EDT 1999
This is a feature of Tkinter - everything returned by cget (and
configure) is a string.  Consider:

    >>> canvas = Tkinter.Canvas()
    >>> print type(canvas.cget('width'))   # width should be int, right?
    <type 'string'>

Years ago, this annoyed me so much that I rewrote Tkinter to return
the "correct" type for all Tk widget options.  The problem with this
is that Tkinter then needs to contain a mapping from all option names
to return type.  Maintaining this list across versions of Tk (and Blt
and Tix and ...) would become a nightmare, so "always a string" is
probably as good as you'll get :)


On 18 Sep, Randall Hopper wrote:
> Is there a simpler way to get the canvas scroll region than this?
> 
>     GETTING THE CANVAS SCROLL REGION:
> 
>         region = canvas.cget( 'scrollregion' )
>         if not region:
>           raise AttributeError, "No scroll region defined for the canvas"
> 
>         region = map( string.atof, string.split( region ) )
> 
> 
> With Python's normal brevity, it surprised me that this much code was needed.

-- 
Greg McFarlane     INMS Telstra Australia     gregm at iname.com
This e-mail is not GST compliant and not has been checked for bacteria.


More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4