tkinter: Accept list and tuple in grid sticky option#15508
tkinter: Accept list and tuple in grid sticky option#15508Akuli merged 6 commits intopython:mainfrom
Conversation
|
This is not the only place where If you need help figuring out which |
This comment has been minimized.
This comment has been minimized.
|
For example, |
|
Notebook add() requires it. Layout do not accept list or tuple. |
|
I must open a new PR for Notebook? |
|
All done, for me. |
This comment has been minimized.
This comment has been minimized.
stdlib/tkinter/ttk.pyi
Outdated
| *, | ||
| state: Literal["normal", "disabled", "hidden"] = ..., | ||
| sticky: str = ..., # consists of letters 'n', 's', 'w', 'e', no repeats, may be empty | ||
| sticky: str | list[str] | tuple[str, ...] = ..., # consists of letters 'n', 's', 'w', 'e', no repeats, may be empty |
There was a problem hiding this comment.
This doesn't work on my system:
>>> from tkinter import ttk
>>> nb = ttk.Notebook()
>>> label = ttk.Label(nb)
>>> nb.add(label, sticky=list('nswe'))
Traceback (most recent call last):
File "<python-input-3>", line 1, in <module>
nb.add(label, sticky=list('nswe'))
~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/tkinter/ttk.py", line 824, in add
self.tk.call(self._w, "add", child, *(_format_optdict(kw)))
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_tkinter.TclError: Bad -sticky specification n s w e
Maybe this has to do with Tk version? What's yours?
>>> import tkinter
>>> tkinter.TkVersion
8.6
There was a problem hiding this comment.
You are right. Do not work. I made a mistake when testing it. Seems that grid is the only one.
Akuli
left a comment
There was a problem hiding this comment.
Thanks for working on this! I reverted this back to your earlier version and will merge soon.
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Added list and tuple to grid sticky option.
Fixes #15507