Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit aecf036

Browse files
authoredOct 8, 2020
bpo-41306: Allow scale value to not be rounded (pythonGH-21715)
This fixes the test failure with Tk 6.8.10 which is caused by changes to how Tk rounds the `from`, `to` and `tickinterval` arguments. This PR uses `noconv` if the patchlevel is greater than or equal to 8.6.10 (credit to Serhiy for this idea as it is much simpler than what I previously proposed). Going into more detail for those who want it, the Tk change was made in [commit 591f68c](tcltk/tk@591f68c) and means that the arguments listed above are rounded relative to the value of `from`. However, when rounding the `from` argument ([line 623](https://github.com/tcltk/tk/blob/591f68cb382525b72664c6fecaab87742b6cc87a/generic/tkScale.c#L623)), it is rounded relative to itself (i.e. rounding `0`) and therefore the assigned value for `from` is always what is given (no matter what values of `from` and `resolution`). Automerge-Triggered-By: @pablogsal
1 parent 4a9f82f commit aecf036

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
 

‎Lib/tkinter/test/test_tkinter/test_widgets.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,8 @@ def test_digits(self):
940940

941941
def test_from(self):
942942
widget = self.create()
943-
self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=float_round)
943+
conv = False if get_tk_patchlevel() >= (8, 6, 10) else float_round
944+
self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=conv)
944945

945946
def test_label(self):
946947
widget = self.create()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed a failure in ``test_tk.test_widgets.ScaleTest`` happening when executing the test with Tk 8.6.10.

0 commit comments

Comments
 (0)
Please sign in to comment.