Skip to content

Added list and tuple to grid sticky option.#15508

Open
melassa wants to merge 5 commits intopython:mainfrom
melassa:master
Open

Added list and tuple to grid sticky option.#15508
melassa wants to merge 5 commits intopython:mainfrom
melassa:master

Conversation

@melassa
Copy link
Contributor

@melassa melassa commented Mar 13, 2026

Added list and tuple to grid sticky option.

@Akuli
Copy link
Collaborator

Akuli commented Mar 13, 2026

This is not the only place where sticky is defined. Searching for sticky gives me:

$ git grep -n sticky
tkinter/__init__.pyi:1141:    sticky: str  # consists of letters 'n', 's', 'w', 'e', no repeats, may be empty
tkinter/__init__.pyi:1156:        sticky: str = ...,  # consists of letters 'n', 's', 'w', 'e', may contain repeats, may be empty
tkinter/ttk.pyi:62:    sticky: str  # consists of letters 'n', 's', 'w', 'e', may contain repeats, may be empty
tkinter/ttk.pyi:75:    sticky: str
tkinter/ttk.pyi:149:        sticky: str = ...,
tkinter/ttk.pyi:697:        sticky: str = ...,  # consists of letters 'n', 's', 'w', 'e', no repeats, may be empty

If you need help figuring out which sticky's should be str and which should be str | list[str] | tuple[str, ...], just let me know :)

@github-actions

This comment has been minimized.

@Akuli
Copy link
Collaborator

Akuli commented Mar 13, 2026

For example, _GridInfo should be just str:

>>> label.grid(sticky=tuple('nswe'))
>>> label.grid_info()['sticky']
'nesw'
>>> label.grid(sticky=list('nswe'))
>>> label.grid_info()['sticky']
'nesw'

@melassa
Copy link
Contributor Author

melassa commented Mar 13, 2026

Notebook add() requires it. Layout do not accept list or tuple.

@melassa
Copy link
Contributor Author

melassa commented Mar 13, 2026

I must open a new PR for Notebook?

@melassa
Copy link
Contributor Author

melassa commented Mar 13, 2026

All done, for me.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

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.

2 participants