[issue35700] Place, Pack and Grid should return the widget

2019-01-09 Thread Peter Vex


Peter Vex  added the comment:

Thank you Zachary, very interesting examples, to say the least!

--
type: enhancement -> behavior
versions: +Python 3.7 -Python 3.8

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



[issue35700] Place, Pack and Grid should return the widget

2019-01-09 Thread Peter Vex


Peter Vex  added the comment:

I can somewhat agreed with your point, even if it's not too realistic, but 
reasonable enough.

Also, I'd only use method chaining, because that'd be the only option. I can't 
pass an argument to tk.Label at creation like 'manager="grid"' or anything like 
that. In any case, I think doing it in a separate line makes the code longer 
and less readable even if it's pythonic.

Thanks for your consideration.

--

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



[issue35700] Place, Pack and Grid should return the widget

2019-01-09 Thread Peter Vex


New submission from Peter Vex :

When you want to simply place a widget on a window and you also want to store 
the reference for that widget in a variable you can't do that in one line, 
which is really unpleasant, because when you create a new widget these things 
are usually the first what you want to do with a widget and breaking it two 
line is just making things more complicated.

For example, if you want to create 3 label, place it next to each other and 
store their reference:

import tkinter as tk
root = tk.Tk()

# you can't do that:
# here the variables assigned to None, since grid() returns 'nothing'
label1 = tk.Label(root).grid(row=0, column=0)
label2 = tk.Label(root).grid(row=0, column=1)
label3 = tk.Label(root).grid(row=0, column=2)

# actually, you must do this:
label1 = tk.Label(root)
label1.grid(row=0, column=0)
label2 = tk.Label(root)
label2.grid(row=0, column=1)
label3 = tk.Label(root)
label3.grid(row=0, column=2)

--
components: Tkinter
messages: 18
nosy: Peter Vex
priority: normal
pull_requests: 10980
severity: normal
status: open
title: Place, Pack and Grid should return the widget
type: behavior
versions: Python 3.7

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