Skip to content

gh-50409: Make action-only tkinter methods return None#152400

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:tkinter-spurious-returns
Open

gh-50409: Make action-only tkinter methods return None#152400
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:tkinter-spurious-returns

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

Many tkinter and tkinter.ttk methods that merely perform an action returned the empty string or empty tuple produced by the underlying Tcl command instead of None. They now return None, like other action methods (and like the corresponding Entry and Canvas methods, which were already correct).

Action-only methods: Spinbox.delete(), Spinbox.icursor(), Spinbox.insert(), Spinbox.invoke(), Spinbox.selection_adjust(), Spinbox.selection_clear(), Wm.wm_deiconify(), Wm.wm_iconify(), Wm.wm_withdraw(), Wm.wm_iconbadge(), Text.edit_redo(), Text.edit_reset(), Text.edit_separator(), Text.edit_undo(), Text.tag_unbind(), PanedWindow.proxy_forget() and PanedWindow.proxy_place().

The setting form of these get/set methods now also returns None (their querying form is unchanged): Spinbox.selection_element(), ttk.Combobox.current(), ttk.Notebook.select(), ttk.Treeview.focus(), ttk.Treeview.cellfocus() and ttk.Treeview.cellselection_anchor().

Many tkinter and tkinter.ttk methods that merely perform an action
returned the empty string or empty tuple produced by the underlying Tcl
command instead of None.  They now return None, like other action methods.
This also affects the setting form of several get/set methods; their
querying form is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant