Issue 13519: Tkinter rowconfigure and columnconfigure functions crash if minsize, pad, or weight is not None (original) (raw)

Created on 2011-12-02 09:11 by aoi.leslie, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Reproduce.py aoi.leslie,2011-12-02 09:11 A python file to reproduce the problem
Messages (5)
msg148752 - (view) Author: aoi.leslie (aoi.leslie) Date: 2011-12-02 09:11
Symptom: When use tkinter Widget class's rowconfigure or columnconfigure function (The two functions are defined in baseclass Misc.) to get the setting for a row or column (The setting is a dict containing fields 'minsize', 'pad', 'weight', and 'uniform'.), if field value of 'minsize', 'pad', or 'weight' is a positive integer instead of None, then error |TypeError: argument of type 'int' is not iterable is raised. Field value of 'uniform' does not matter. Speculation: File tkinter.__init__ , function
msg148779 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-12-02 23:18
Running on Win 7, 3.2.2, IDLE, I get ''' Traceback (most recent call last): File "F:\Python\mypy\tem.py", line 19, in the_rowconfigure_info = the_frame.rowconfigure(the_row_index) File "C:\Programs\Python32\lib\tkinter\__init__.py", line 1326, in grid_rowconfigure return self._grid_configure('rowconfigure', index, cnf, kw) File "C:\Programs\Python32\lib\tkinter\__init__.py", line 1279, in _grid_configure elif '.' in value: TypeError: argument of type 'int' is not iterable ''' (For tracker purposes, this is a graceful exit, not a crash - as in *nix segfault or equivalent Windows error box.) ''' >>> help(Frame.rowconfigure) Help on function grid_rowconfigure in module tkinter: grid_rowconfigure(self, index, cnf={}, **kw) Configure row INDEX of a grid. Valid resources are minsize (minimum size of the row), weight (how much does additional space propagate to this row) and pad (how much space to let additionally). ''' The above implies that setting uniform=1 (in your code) works because it is ignored. From docs on the web, it appears that 'uniform' is valid and is just missing from our doc string. It is different from the other three, though, in jperhaps not being restricted to int values. You are right that (line 1259) def _grid_configure(self, command, index, cnf, kw): expects strings (which is what tcl uses). I do not know enough, though, to know where the bug is. I do notice, however, that setting with a Python int matches online Python examples and that the code runs without the attempt to read the config.
msg148785 - (view) Author: aoi.leslie (aoi.leslie) Date: 2011-12-03 03:35
Setting the config has no problem. Only reading has. The config is read from Tk at line 1270 by code res = self.tk.call('grid', command, self._w, index) . If each of the four options (minsize, pad, uniform, and weight) has been set to value 1, |res 's value after the tk call would be a tuple ('-minsize', 1, '-pad', 1, '-uniform', '1', '-weight', 1) . This explains why
msg197763 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-09-15 11:18
I think this was fixed in .
msg199741 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2013-10-13 18:08
I agree.
History
Date User Action Args
2022-04-11 14:57:24 admin set github: 57728
2013-10-13 18:08:03 georg.brandl set status: pending -> closednosy: + georg.brandlmessages: + resolution: fixed
2013-09-15 11🔞33 serhiy.storchaka set status: open -> pendingnosy: + serhiy.storchakamessages: +
2013-06-15 18:45:07 terry.reedy set versions: + Python 3.4, - Python 3.2
2011-12-03 03:35:57 aoi.leslie set messages: +
2011-12-02 23🔞47 terry.reedy set versions: + Python 2.7, Python 3.3nosy: + gpolo, terry.reedymessages: + type: crash -> behavior
2011-12-02 09:11:10 aoi.leslie create