| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…_tkinter FromObj() now returns str for the "index", "window", "nsName" and "parsedVarName" object types, whose internal representation is only a context-bound lookup with nothing worth preserving in a Tcl_Obj. An "index" value is one of a small fixed set of enumeration keywords, so its str is interned. A "pixel" screen distance with no unit suffix is screen independent and is now returned as an int or float. A distance with an m/c/i/p suffix needs a Tk_Window to be resolved and is kept as a Tcl_Obj, as are the "dict" and the resource types "color", "border", "font" and "cursor". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Documentation build overview3 files changed ± library/tkinter.html ± whatsnew/3.16.html ± whatsnew/changelog.html |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
With wantobjects enabled (the default), FromObj() now converts a few more Tcl object types to the natural Python type instead of wrapping them in an opaque _tkinter.Tcl_Obj.
str for types whose internal representation is only a throwaway, context-bound lookup with nothing worth preserving for a round-trip back to Tcl: index (an enumeration keyword, e.g. the value of -orient or -state), window (e.g. -labelwidget), nsName (a namespace name) and parsedVarName (e.g. -variable). An index value is always one of a small fixed set of keywords, so the resulting str is interned — equal keywords share a single object.
int/float for the pixel type: a screen distance with no unit suffix is already in pixels and screen-independent, so it is returned as a number. A distance with an m/c/i/p suffix depends on the screen resolution and needs a Tk_Window to resolve (not available in FromObj()), so it is kept as a Tcl_Obj.
Deliberately left as Tcl_Obj: color, border, font and cursor, whose internal representation caches an allocated X/font resource that Tk reuses when the object is passed back; and dict, a structured value best consumed with _splitdict().
Only the object mode is affected; with wantobjects disabled everything is already str. Verified across Tcl/Tk 8.6, 8.7, 9.0 and 9.1, with wantobjects both enabled and disabled. The unit-bearing-distance-stays-Tcl_Obj behavior is Tk 9.0+ only (classic-widget cget on Tk < 9 eagerly resolves a unit-bearing distance to an integer pixel count), and the nsName object type exists only on Tk 9.0+.
🤖 Generated with Claude Code