Skip to content

gh-151890: Support more photo image options in tkinter.PhotoImage methods#151891

Merged
serhiy-storchaka merged 3 commits into
python:mainfrom
serhiy-storchaka:tkinter-photoimage-tk9-options
Jun 22, 2026
Merged

gh-151890: Support more photo image options in tkinter.PhotoImage methods#151891
serhiy-storchaka merged 3 commits into
python:mainfrom
serhiy-storchaka:tkinter-photoimage-tk9-options

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jun 21, 2026

Copy link
Copy Markdown
Member

Add parameters mapping to Tk photo image options that previously had no tkinter equivalent and were reachable only through tk.call().

  • The format parameter of PhotoImage.put() (since Tk 8.6) specifies the format of the image data.
  • The metadata parameter of PhotoImage.put(), read(), write() and data() (new in Tk 9.0) passes a metadata dictionary to the image format driver.
  • The withalpha parameter of PhotoImage.get() (new in Tk 9.0) returns the alpha value of the pixel in addition to its color.

The new option parameters are keyword-only. puts format works on the bundled Tk; the metadata and withalpha parameters require Tcl/Tk 9.0, and their tests are gated on @requires_tk(9, 0).

🤖 Generated with Claude Code

@read-the-docs-community

read-the-docs-community Bot commented Jun 21, 2026

Copy link
Copy Markdown

…ge methods

Add parameters mapping to Tk photo image options that previously had no
tkinter equivalent:

* the format parameter of PhotoImage.put() (Tk 8.6),
* the metadata parameter of PhotoImage.put(), read(), write() and data()
  (Tk 9.0),
* the withalpha parameter of PhotoImage.get() (Tk 9.0).

The new option parameters are keyword-only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XWevzas4XVpjzedzR9gKVo
@serhiy-storchaka serhiy-storchaka force-pushed the tkinter-photoimage-tk9-options branch from 1abd0ec to 6c692ff Compare June 22, 2026 01:21
@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) June 22, 2026 11:51
@serhiy-storchaka serhiy-storchaka merged commit 34eca5a into python:main Jun 22, 2026
51 checks passed
@serhiy-storchaka serhiy-storchaka deleted the tkinter-photoimage-tk9-options branch June 22, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant