Zachary Ware <zachary.w...@gmail.com> added the comment:

I agree with Serhiy that we shouldn't do this; tkinter is (mostly) just a thin 
wrapper around Tcl/Tk and this isn't enough of a win to deviate from that.  In 
any case, this would be an enhancement that could only go into 3.8 at this 
point.

For your particular example, it would prefer to read the following anyway:

```
import tkinter as tk

root = tk.Tk()

labels = []
for i in range(3):
    label = tk.Label(root)
    label.grid(row=0, column=i)
    labels.append(label)
```


Or if you really want this feature in your own code, try this out:

```
import tkinter as tk
from functools import partial

def _mapped(method, widget, *args, **kwargs):
    getattr(widget, method)(*args, **kwargs)
    return widget

packed = partial(_mapped, 'pack')
gridded = partial(_mapped, 'grid')
placed = partial(_mapped, 'place')

root = tk.Tk()

label1 = gridded(tk.Label(root), row=0, column=0)
label2 = gridded(tk.Label(root), row=0, column=1)
label3 = gridded(tk.Label(root), row=0, column=2)
```

----------
nosy: +zach.ware
type: behavior -> enhancement
versions: +Python 3.8 -Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35700>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to