FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-39107: Updated Tcl and Tk to 8.6.10 in Windows installer by zooba · Pull Request #22405 · python/cpython · GitHub

/ cpython Public

bpo-39107: Updated Tcl and Tk to 8.6.10 in Windows installer - #22405

Merged
zooba merged 5 commits into
masterfrom
bpo-39107
Oct 19, 2020
Merged

bpo-39107: Updated Tcl and Tk to 8.6.10 in Windows installer#22405
zooba merged 5 commits into
masterfrom
bpo-39107

Conversation

zooba commented Sep 24, 2020
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

On Windows tk 8.6.10, tk Scale no longer rounds 'from',
thus matching ttk Scale behavior.

terryjreedy commented Sep 25, 2020
edited
Loading

Copy link
Copy Markdown
Member

I verified that the only failure is in test.test_tk:

FAIL: test_from (tkinter.test.test_tkinter.test_widgets.ScaleTest)
Traceback (most recent call last):
File "f:\dev\3x\lib\tkinter\test\test_tkinter\test_widgets.py", line 943, in test_from
self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=float_round)
File "f:\dev\3x\lib\tkinter\test\widget_tests.py", line 106, in checkFloatParam
self.checkParam(widget, name, value, conv=conv, **kwargs)
File "f:\dev\3x\lib\tkinter\test\widget_tests.py", line 63, in checkParam
self.assertEqual2(widget[name], expected, eq=eq)
File "f:\dev\3x\lib\tkinter\test\widget_tests.py", line 47, in assertEqual2
self.assertEqual(actual, expected, msg)
AssertionError: 14.9 != 15.0

The other 3 tkinter test files, test_idle, and test_turtle run OK.

The reason is that on Windows, tkinter.Scale['from'] was 'fixed' to match the behavior of tkinter.ttk.Scale.

In 3.9:

>>> import tkinter as tk
>>> r = tk.Tk()
>>> s = tk.Scale(r, from_=14.9)
>>> s.pack()
>>> s['from']
15.0
>>> from tkinter import ttk
>>> sk = ttk.Scale(r, from_=14.9)
>>> sk['from']
14.9

So test_from for tk and ttk respectively use float_round() = float(round()) and False.
self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=self.float_round)
self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=False)

In 8.6.10, s['from'] is 14.9 for tk.Scale also. So on Windows, conv should be False.

For tk.Scale, s['to'] is adjusted according to the s['from'], so if 'from' is left as the default 0.0, 14.9 and 15.1 are adjusted to 15.0. This is not true for ttk.Scale. Anyway, since test_to passes, we leave it alone.

terryjreedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

About IDLE shows 3.6.10 and the existing automated tests now pass.

def test_from(self):
widget = self.create()
self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=float_round)
cvt = False if sys.platform == 'win32' else float_round # 39107

serhiy-storchaka Sep 25, 2020
edited by taleinat
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It should depend not on platform, but on Tk version. Use get_tk_patchlevel().

Also, it would be better to use name conv instead of cvt for consistency.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Agreed. However, I could not fine that name in either tkinter or _tkinter, so I used the tk call used in idlelib.help_about. I used an equality check. But it would not work for an 8.6.11. Is such possible?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

get_tk_patchlevel is defined in tkinter.test.support and is already imported in this file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Fixed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Serhiy, do you prefer passing False, as the ttk Scale test does, or 'noconv', as in #21715?
Do you want a comment added, such as in the other PR?
Please decide whether you want to close the other issue and PR or merge it and remove the test change here.
Either way, I would like to get this merged so we can routinely test tkinter and IDLE on Windows with 8.6.10 in place.

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

zooba commented Sep 28, 2020

Copy link
Copy Markdown
Member Author

@serhiy-storchaka Looks like we're waiting on you - any further comment?

zooba merged commit 985f0ab into master Oct 19, 2020
zooba deleted the bpo-39107 branch October 19, 2020 15:55

52LY commented Mar 5, 2021

Copy link
Copy Markdown

I verified that the only failure is in test.test_tk:

FAIL: test_from (tkinter.test.test_tkinter.test_widgets.ScaleTest)
Traceback (most recent call last):
File "f:\dev\3x\lib\tkinter\test\test_tkinter\test_widgets.py", line 943, in test_from
self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=float_round)
File "f:\dev\3x\lib\tkinter\test\widget_tests.py", line 106, in checkFloatParam
self.checkParam(widget, name, value, conv=conv, **kwargs)
File "f:\dev\3x\lib\tkinter\test\widget_tests.py", line 63, in checkParam
self.assertEqual2(widget[name], expected, eq=eq)
File "f:\dev\3x\lib\tkinter\test\widget_tests.py", line 47, in assertEqual2
self.assertEqual(actual, expected, msg)
AssertionError: 14.9 != 15.0

The other 3 tkinter test files, test_idle, and test_turtle run OK.

The reason is that on Windows, tkinter.Scale['from'] was 'fixed' to match the behavior of tkinter.ttk.Scale.

In 3.9:

>>> import tkinter as tk
>>> r = tk.Tk()
>>> s = tk.Scale(r, from_=14.9)
>>> s.pack()
>>> s['from']
15.0
>>> from tkinter import ttk
>>> sk = ttk.Scale(r, from_=14.9)
>>> sk['from']
14.9

So test_from for tk and ttk respectively use float_round() = float(round()) and False.
self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=self.float_round)
self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=False)

In 8.6.10, s['from'] is 14.9 for tk.Scale also. So on Windows, conv should be False.

For tk.Scale, s['to'] is adjusted according to the s['from'], so if 'from' is left as the default 0.0, 14.9 and 15.1 are adjusted to 15.0. This is not true for ttk.Scale. Anyway, since test_to passes, we leave it alone.

s[''resolution'] = 0.1
s['from_'] = 15.9
s['from_']
15.900000000000002
default, s[''resolution']=1, so 15.9 ==> 16, 15.5 ==> 16, 15.49 ==> 15

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL