[New-bugs-announce] [issue22226] Refactor dict result handling in Tkinter

Serhiy Storchaka report at bugs.python.org
Tue Aug 19 08:16:14 CEST 2014

New submission from Serhiy Storchaka:

Proposed patch refactors code which converts the result of Tcl call to Python dict. Added new private function _splitdict() which does this in more robust manner.

Also this patch fixes a bug in Treeview.heading(). The heading subcommand of ttk::treeview return options dict in which one key surprisingly was not '-' prefixed.

% ttk::treeview t
% .t heading #0
-text {} -image {} -anchor center -command {} state {}

Current code unconditionally cuts "s" from the "state" key.

>>> from tkinter import ttk
>>> t = ttk.Treeview()
>>> t.heading('#0')
{'anchor': 'center', 'tate': '', 'image': '', 'text': '', 'command': ''}

assignee: serhiy.storchaka
components: Tkinter
files: tkinter_splitdict.diff
keywords: patch
messages: 225515
nosy: gpolo, serhiy.storchaka, terry.reedy
priority: normal
severity: normal
stage: patch review
status: open
title: Refactor dict result handling in Tkinter
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36411/tkinter_splitdict.diff

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list