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.
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