This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
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 |_grid_configure|, line 1279, code |elif '.' in value| caused this error. The code assumes the value is a str, but the value can be int. Suggested Fix: Change the code block around line 1279 to handle int value as well. |
|||
| 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 <module> 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 |uniform|'s value does not cause problem, because it is a str, while the other three's are int. Also int 0 does not cause problem because it is handled at line 1277 by code
if not value:
value = None
so the resulting option value appears as None in rowconfigure or columnconfigure's resulting dict.
In my speculation, the bug is that, when converting from the tuple returned by tk call into the resulting dict to be returned by rowconfigure or columnconfigure, the converting code assumes that the option values in the tuple returned by tk call are all str. But somehow only |uniform|'s value is str, while other three's are int.
|
|||
| msg197763 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年09月15日 11:18 | |
I think this was fixed in issue16809. |
|||
| 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 -> closed nosy: + georg.brandl messages: + msg199741 resolution: fixed |
| 2013年09月15日 11:18:33 | serhiy.storchaka | set | status: open -> pending nosy: + serhiy.storchaka messages: + msg197763 |
| 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: + msg148785 |
| 2011年12月02日 23:18:47 | terry.reedy | set | versions:
+ Python 2.7, Python 3.3 nosy: + gpolo, terry.reedy messages: + msg148779 type: crash -> behavior |
| 2011年12月02日 09:11:10 | aoi.leslie | create | |