New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the grid geometry manager and add tests for geometry managers #64834
Comments
Here is a patch which adds tests for Tk geometry managers (pack, place and grid). In additional it fixes the grid_columnconfigure() and grid_rowconfigure() methods which did not worked with wantobject=True (preferable and default mode). |
On OS X 10.9 with Cocoa Tk 8.15.0+, Cocoa Tk 8.6, and X11 Tk 8.6: ====================================================================== Traceback (most recent call last):
File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_geometry_managers.py", line 440, in test_place_forget
self.assertTrue(foo.winfo_ismapped())
AssertionError: 0 is not true With OS X Carbon Tk 8.4, the grid_anchor and grid_configure tests fail: ====================================================================== Traceback (most recent call last):
File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_geometry_managers.py", line 489, in tearDown
self.root.grid_anchor('nw')
File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 1321, in grid_anchor
self.tk.call('grid', 'anchor', self._w, anchor)
_tkinter.TclError: bad option "anchor": must be bbox, columnconfigure, configure, forget, info, location, propagate, remove, rowconfigure, size, or slaves ====================================================================== Traceback (most recent call last):
File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_geometry_managers.py", line 617, in test_grid_columnconfigure
self.root.grid_columnconfigure('all', weight=3)
File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 1389, in grid_columnconfigure
return self._grid_configure('columnconfigure', index, cnf, kw)
File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 1379, in _grid_configure
+ options)
_tkinter.TclError: expected integer but got "all" ... along with: ====================================================================== Traceback (most recent call last):
File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_geometry_managers.py", line 671, in test_grid_rowconfigure
self.root.grid_rowconfigure('all', weight=3)
File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 1416, in grid_rowconfigure
return self._grid_configure('rowconfigure', index, cnf, kw)
File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 1379, in _grid_configure
+ options)
_tkinter.TclError: expected integer but got "all" ====================================================================== Traceback (most recent call last):
File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_geometry_managers.py", line 294, in test_place_configure_in
self.assertEqual(f2.winfo_manager(), '')
AssertionError: 'place' != ''
- place
+ ====================================================================== Traceback (most recent call last):
File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_geometry_managers.py", line 440, in test_place_forget
self.assertTrue(foo.winfo_ismapped())
AssertionError: 0 is not true ====================================================================== During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_geometry_managers.py", line 583, in test_grid_configure_row
b.grid_configure(row=-1)
AssertionError: "bad row value "-1": must be a non-negative integer" does not match "bad grid value "-1": must be a non-negative integer" Ran 597 tests in 4.270s FAILED (failures=4, errors=32, skipped=16) |
My fault. I tested the patch with 8.5 and 8.6, but was too lazy to check it with 8.4. Here is updated patch with workarounded 8.4 peculiarities. I'm not sure about test_place_forget(). I have removed the check, hope this will help. Thank you Ned. |
With test_geometry_managers_2.patch, test_tk now passes with all of the previously tested OS X Tk versions. |
Unfortunately new tests emit on 3.3 and 2.7 same warnings as in bpo-20567. So I have committed only the fix, without tests. |
Changesets 857ddbaff14e (2.7), 6227b0ecb5fb (3.3) and b6df5f8f86d3 (default). |
New changeset e8c184d8407d by Serhiy Storchaka in branch '3.4': New changeset e8acef4f8567 by Serhiy Storchaka in branch 'default': |
Here is a patch for 2.7. |
test_tk with test_geometry_managers_2-2.7.patch applied passed on OS X 10.9 linked with Carbon Tk 8.4.20, Cocoa 8.5.15, Cocoa 8.6.1, and X11 8.6.1. |
New changeset 9ab1225b6cc5 by Serhiy Storchaka in branch '2.7': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: