8000 gh-124111: Update tkinter for compatibility with Tcl/Tk 9.0.0 by culler · Pull Request #124156 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-124111: Update tkinter for compatibility with Tcl/Tk 9.0.0 #124156

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

Merged
merged 30 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
797ab58
New branch for PR against Python 3.14.
culler Sep 17, 2024
03ccc1b
Ttk tests on linux
culler Sep 17, 2024
d7fdc88
Remove trailing whitespace.
culler Sep 17, 2024
9fe5e01
Add NEWS file.
culler Sep 17, 2024
144c754
Make Windows build work; adjust for new changes to Canvas.
culler Sep 19, 2024
3b21086
Attempt to restore autogenerated files that git tricked me into commi…
culler Sep 19, 2024
485e38a
Revert other autogenerated files committed by mistake
culler Sep 19, 2024
5a954ec
Revert one more autogenerated file committed by mistake
culler Sep 19, 2024
50d6958
Reference for combobox issue; address conditional definitions of _cli…
culler Sep 19, 2024
ee186de
Revert PCbuild changes; add examples for tk 9
culler Sep 19, 2024
1318d04
Adjust no_round for Canvas and Scrollbar.
culler Sep 20, 2024
e68994f
Adjust _clipped for Canvas once more.
culler Sep 20, 2024
c069c89
Hmmm = Canvas does clip highlightthickness.
culler Sep 20, 2024
8072c54
Remove message catalog.
culler Sep 20, 2024
ec56443
Force checks to rerun sin 8000 ce CLA signing seems hung. (No changes.)
culler Sep 20, 2024
4f753f8
Merge branch 'tk9_for_python314' of github.com:culler/cpython into tk…
culler Sep 23, 2024
bf2243f
Update build files to use Tcl/Tk 8.6.14 by default but to allow any v…
culler Sep 23, 2024
77396d8
Add changes suggested by @zware
culler Sep 24, 2024
cf9b947
Remove trailing whitespace.
culler Sep 24, 2024
2ef001b
Deal with test_configure_width and test_configure_height for Notebooks.
culler Sep 25, 2024
cc50039
Merge branch 'tk9_for_python314' of github.com:culler/cpython into tk…
culler Sep 25, 2024
6a9ebc1
Need to make tests pass with 8.6.14 too, for the PR checks.
culler Sep 25, 2024
406aeff
Fix version tests in NotebookTest
culler Sep 25, 2024
5edecc1
Include changes suggested by @zware
culler Sep 25, 2024
f661969
Merge branch 'main' into tk9_for_python314
zware Sep 25, 2024
822c3bf
Add changes to tcltk.props and _tkinter.vcxproj suggested by @zooba
culler Sep 29, 2024
7d851a8
Merge branch 'tk9_for_python314' of github.com:culler/cpython into tk…
culler Sep 29, 2024
635d807
Merge branch 'main' into tk9_for_python314
culler Sep 29, 2024
ba09108
Merge remote-tracking branch 'origin/main' into tk9_for_python314
zware Nov 14, 2024
9075a80
Formatting fixups, remove note from build.bat
zware Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove message catalog.
  • Loading branch information
culler committed Sep 20, 2024
commit 8072c54d9a49d1f3914f41 8000 b0a9fdca732404f350
12 changes: 0 additions & 12 deletions Lib/test/test_tkinter/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@
import re
import tkinter

messages_v1 = {
'no_busy': 'can\'t find busy window.*',
'no_font': 'font "{}" doesn\'t exist',
'no_image': 'image "{}" doesn\'t exist',
}

messages_v2 = {
'no_busy': 'cannot find busy window',
'no_font': 'font "{}" does not exist',
'no_image': 'image "{}" does not exist',
}

class AbstractTkTest:

@classmethod
Expand Down
13 changes: 5 additions & 8 deletions Lib/test/test_tkinter/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@

support.requires('gui')

if tk_version < (9,0):
from test.test_tkinter.support import messages_v1 as messages
else:
from test.test_tkinter.support import messages_v2 as messages

class MiscTest(AbstractTkTest, unittest.TestCase):

def test_all(self):
Expand Down Expand Up @@ -71,9 +66,10 @@ def test_tk_busy(self):
f.tk_busy_forget()
self.assertFalse(f.tk_busy_status())
self.assertFalse(f.tk_busy_current())
with self.assertRaisesRegex(TclError, messages['no_busy']):
errmsg = r"can(no|')t find busy window.*"
with self.assertRaisesRegex(TclError, errmsg):
f.tk_busy_configure()
with self.assertRaisesRegex(TclError, messages['no_busy']):
with self.assertRaisesRegex(TclError, errmsg):
f.tk_busy_forget()

@requires_tk(8, 6, 6)
Expand All @@ -92,7 +88,8 @@ def test_tk_busy_with_cursor(self):
self.assertEqual(f.tk_busy_configure('cursor')[4], 'heart')

f.tk_busy_forget()
with self.assertRaisesRegex(TclError, messages["no_busy"]):
errmsg = r"can(no|')t find busy window.*"
with self.assertRaisesRegex(TclError, errmsg):
f.tk_busy_cget('cursor')

def test_tk_setPalette(self):
Expand Down
10 changes: 5 additions & 5 deletions Lib/test/test_tkinter/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
from test.test_tkinter.support import (requires_tk, tk_version,
get_tk_patchlevel, widget_eq,
AbstractDefaultRootTest)
if tk_version < (9, 0):
from test.test_tkinter.support import messages_v1 as messages, is_pixel_str
else:
from test.test_tkinter.support import messages_v2 as messages, is_pixel_str

from test.test_tkinter.widget_tests import (
add_configure_tests,
AbstractWidgetTest,
Expand Down Expand Up @@ -323,7 +320,10 @@ def test_configure_image(self):
widget = self.create()
image = tkinter.PhotoImage(master=self.root, name='image1')
self.checkParam(widget, 'image', image, conv=str)
errmsg = messages['no_image'].format('spam')
if tk_version < (9, 0):
errmsg = 'image "spam" doesn\'t exist'
else:
errmsg = 'image "spam" does not exist'
with self.assertRaises(tkinter.TclError) as cm:
widget['image'] = 'spam'
if errmsg is not None:
Expand Down
17 changes: 10 additions & 7 deletions Lib/test/test_tkinter/widget_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
import tkinter
from test.test_tkinter.support import (AbstractTkTest, requires_tk, tk_version,
pixels_conv, tcl_obj_eq)
if tk_version < (9,0):
from test.test_tkinter.support import is_pixel_str, messages_v1 as messages
else:
from test.test_tkinter.support import is_pixel_str, messages_v2 as messages
import test.support

_sentinel = object()
Expand Down Expand Up @@ -179,8 +175,12 @@ def checkReliefParam(self, widget, name, *, allow_empty=False):
def checkImageParam(self, widget, name):
image = tkinter.PhotoImage(master=self.root, name='image1')
self.checkParam(widget, name, image, conv=str)
if tk_version < (9, 0):
errmsg = 'image "spam" doesn\'t exist'
else:
errmsg = 'image "spam" does not exist'
self.checkInvalidParam(widget, name, 'spam',
errmsg=messages['no_image'].format('spam'))
errmsg=errmsg)
widget[name] = ''

def checkVariableParam(self, widget, name, var):
Expand Down Expand Up @@ -356,8 +356,11 @@ def test_configure_font(self):
'-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*')
is_ttk = widget.__class__.__module__ == 'tkinter.ttk'
if not is_ttk:
self.checkInvalidParam(widget, 'font', '',
errmsg=messages['no_font'].format(''))
if tk_version < (9,0):
errmsg = 'font "" doesn\'t exist'
else:
errmsg = 'font "" does not exist'
self.checkInvalidParam(widget, 'font', '', errmsg=errmsg)

def test_configure_foreground(self):
widget = self.create()
Expand Down
11 changes: 5 additions & 6 deletions Lib/test/test_ttk/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
from test.test_tkinter.support import (
AbstractTkTest, requires_tk, tk_version, get_tk_patchlevel,
simulate_mouse_click, AbstractDefaultRootTest)
if tk_version < (9,0):
from test.test_tkinter.support import messages_v1 as messages
else:
from test.test_tkinter.support import messages_v2 as messages
from test.test_tkinter.widget_tests import (add_configure_tests,
AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests)

Expand Down Expand Up @@ -186,8 +182,11 @@ def checkImageParam(self, widget, name):
expected=('image1', 'active', 'image2'))
self.checkParam(widget, name, 'image1 active image2',
expected=('image1', 'active', 'image2'))
self.checkInvalidParam(widget, name, 'spam',
errmsg=messages['no_image'].format('spam'))
if tk_version < (9, 0):
errmsg = 'image "spam" doesn\'t exist'
else:
errmsg = 'image "spam" does not exist'
self.checkInvalidParam(widget, name, 'spam', errmsg=errmsg)

def test_configure_compound(self):
values = ('none', 'text', 'image', 'center', 'top', 'bottom', 'left', 'right')
Expand Down
Loading
0