Commit Graph

213 Commits

Author SHA1 Message Date
Miss Islington (bot) 9d727fe739
[3.11] gh-107262: Update Tkinter tests for Tcl/Tk 8.6.14 (GH-119322) (#130276)
Co-authored-by: James De Bias <81095953+DBJim@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-02-19 10:51:35 +02:00
Miss Islington (bot) 02497b7ac2
[3.11] gh-116484: Fix collisions between Checkbutton and ttk.Checkbutton default names (GH-116495) (GH-116902)
Change automatically generated tkinter.Checkbutton widget names to
avoid collisions with automatically generated tkinter.ttk.Checkbutton
widget names within the same parent widget.
(cherry picked from commit c61cb507c1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-03-16 11:58:10 +00:00
Miss Islington (bot) f18341fa4e
[3.11] gh-113951: Tkinter: "tag_unbind(tag, sequence, funcid)" now only unbinds "funcid" (GH-113955) (GH-114998)
Previously, "tag_unbind(tag, sequence, funcid)" methods of Text and
Canvas widgets destroyed the current binding for "sequence", leaving
"sequence" unbound, and deleted the "funcid" command.

Now they remove only "funcid" from the binding for "sequence", keeping
other commands, and delete the "funcid" command.
They leave "sequence" unbound only if "funcid" was the last bound command.
(cherry picked from commit 7e42fddf60)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-04 16:47:03 +00:00
Miss Islington (bot) b4a6bbdd7d
[3.11] gh-113877: Fix Tkinter method winfo_pathname() on 64-bit Windows (GH-113900) (GH-113902)
winfo_id() converts the result of "winfo id" command to integer, but
"winfo pathname" command requires an argument to be a hexadecimal number
on Win64.
(cherry picked from commit 1b7e0024a1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-10 10:50:51 +00:00
Miss Islington (bot) 010819a295
[3.11] gh-75666: Tkinter: "unbind(sequence, funcid)" now only unbinds "funcid" (GH-111322) (GH-112801)
Previously, "widget.unbind(sequence, funcid)" destroyed the current binding
for "sequence", leaving "sequence" unbound, and deleted the "funcid"
command.

Now it removes only "funcid" from the binding for "sequence", keeping
other commands, and deletes the "funcid" command.
It leaves "sequence" unbound only if "funcid" was the last bound command.

(cherry picked from commit cc7e45cc57)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: GiovanniL <13402461+GiovaLomba@users.noreply.github.com>
2023-12-06 15:04:07 +00:00
Miss Islington (bot) c3e5d0d936
[3.11] gh-68166: Tkinter: Add tests and examples for element_create() (GH-111453) (GH-111858)
* Remove mention of "vsapi" element type from the documentation.
* Add tests for element_create() and other ttk.Style methods.
* Add examples for element_create() in the documentation.

(cherry picked from commit 005d1e8fc8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-11-27 20:14:30 +00:00
Miss Islington (bot) c905fab338
[3.11] gh-75666: Tkinter: add tests for binding (GH-111202) (GH-111256)
(cherry picked from commit 9bb202a1a9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-10-24 14:53:38 +03:00
Miss Islington (bot) 035f9e0cc5
[3.11] gh-107705: Fix file leak in test_tkinter in the C locale (GH-110507) (GH-110858)
(cherry picked from commit ca0f3d858d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-10-14 06:40:18 +00:00
Miss Islington (bot) af08bcab8f
[3.11] gh-100814: Fix exception for invalid callable value of Tkinter image option (GH-107692) (GH-107723)
Passing a callable object as an option value to a Tkinter image now raises
the expected TclError instead of an AttributeError.
(cherry picked from commit 50e3cc9748)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-08-16 11:07:02 +03:00
Serhiy Storchaka 81c8f7d619
[3.11] gh-104496: Use correct Tcl or Tk version in Tkinter tests (GH-107688) (GH-107719)
In future Tcl and Tk versions can be desynchronized.
(cherry picked from commit 3c8e8f3cee)
2023-08-07 14:48:43 +00:00
Miss Islington (bot) dcfa8165ad
[3.11] gh-104497: Make tkinter test pass with tk 8.7 (GH-104789) (#105029)
For test_widgets.MenuTest.test_configure_type, the options
in the error message change to alphabetical order.
---------

(cherry picked from commit 897e716d03)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-05-27 17:52:14 -04:00
Miss Islington (bot) dece9c06bb
[3.11] gh-104494: Update certain Tkinter pack/place tests for Tk 8.7 errors (GH-104495) (#104569)
gh-104494: Update certain Tkinter pack/place tests for Tk 8.7 errors (GH-104495)
(cherry picked from commit 3cba61f111)

Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-16 20:03:51 -04:00
Miss Islington (bot) 7779027084
[3.11] gh-104461: Run tkinter test_configure_screen on X11 only (GH-104526)
Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
2023-05-16 02:47:51 +00:00
Miss Islington (bot) dc08c7a515
[3.11] gh-103685: Fix tkinter.Menu.index() for Tk 8.7 (GH-103686) (#103734)
gh-103685: Fix tkinter.Menu.index() for Tk 8.7 (GH-103686)

---------

(cherry picked from commit f0ed293f6a)

Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2023-04-23 22:29:58 -04:00
Miss Islington (bot) 05111d0a64
Add more tkinter.Canvas tests (GH-98475)
It is a prerequisite for GH-94473. Add tests for the coords() method and
for creation of some Canvas items.
(cherry picked from commit ff173ed2f6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-10-20 04:04:45 -07:00
Miss Islington (bot) 30b9c4d784
gh-97928: Fix handling options starting with "-" in tkinter.Text.count() (GH-98436)
Previously they were silently ignored. Now they are errors.
(cherry picked from commit e4ec8de6fa)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-10-19 02:57:27 -07:00
Miss Islington (bot) a847255cbb
gh-97928: Add tests for tkinter.Text.count() (GH-98269)
(cherry picked from commit 1b684c8f5f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-10-18 23:44:43 -07:00
Miss Islington (bot) 04aa15f5e7
gh-73588: Fix generation of the default name of tkinter.Checkbutton. (GH-97547)
Previously, checkbuttons in different parent widgets could have the same
short name and share the same state if arguments "name" and "variable" are
not specified. Now they are globally unique.
(cherry picked from commit adbed2d542)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-09-27 04:34:24 -07:00
Serhiy Storchaka 15dbe8570f
gh-91827: Add method info_pathlevel() in tkinter (GH-91829) 2022-05-06 13:50:38 +03:00
Serhiy Storchaka c2e3c06139
bpo-46996: Remove support of Tcl/Tk < 8.5.12 (GH-31839) 2022-03-17 13:05:52 +02:00
Serhiy Storchaka dbbe4d2d00
bpo-45979: Fix Tkinter tests with old Tk (>= 8.5.12) (GH-31938) 2022-03-16 19:39:00 +02:00
E-Paine 2e3e0d23ad
bpo-45496: Allow flexibility in winfo_rgb tests (GH-30185) 2021-12-26 13:28:24 +02:00
Serhiy Storchaka cc1cbcbb2d
bpo-27313: Use non-deprecated methods for tracing (GH-29425) 2021-11-06 20:01:39 +01:00
Łukasz Langa e52f9bee80
bpo-27313: Fix ttk_guionly tests failing on Framework builds on macOS (GH-29411) 2021-11-05 09:53:13 +01:00
Łukasz Langa 54d1e3f72e
bpo-45160: Fix refleak in test_ttk_guionly introduced in GH-28291 (GH-29416) 2021-11-05 09:51:31 +01:00
E-Paine add46f8476
bpo-45160: Ttk optionmenu only set variable once (GH-28291) 2021-10-21 22:25:52 +02:00
Gregory P. Smith 1dfac27dff
Cleanup a couple of comments left on PR 28775 post-merge. (GH-29079) 2021-10-20 09:17:52 -07:00
Zachary Ware 4fe454c6f5
bpo-45436: Fix tkinter tests with Tcl/Tk 8.6.11+ (GH-29077)
Since v8.6.11, a few configuration options seem to accept an empty value
where they did not previously; particularly the `type` of a `Menu`
widget, and the `compound` of any ttk widget with a label.  Providing an
explicit expected error message to `checkEnumParam` bypasses the check
of an empty value, which no longer raises `TclError`.
2021-10-19 21:54:19 -05:00
Serhiy Storchaka f59ed3c310
bpo-45229: Make tkinter tests discoverable (GH-28637) 2021-10-13 18:12:48 +02:00
Christian Clauss 745c9d9dfc
Fix typos in the Lib directory (GH-28775)
Fix typos in the Lib directory as identified by codespell.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2021-10-06 16:13:48 -07:00
Serhiy Storchaka 2a8127cafe
bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005) 2021-08-29 14:04:40 +03:00
E-Paine e9c8f784fa
bpo-44404: tkinter `after` support callable classes (GH-26812) 2021-06-23 13:30:24 +03:00
Ethan Furman a02cb474f9
bpo-38659: [Enum] add _simple_enum decorator (GH-25497)
add:

* `_simple_enum` decorator to transform a normal class into an enum
* `_test_simple_enum` function to compare
* `_old_convert_` to enable checking `_convert_` generated enums

`_simple_enum` takes a normal class and converts it into an enum:

    @simple_enum(Enum)
    class Color:
        RED = 1
        GREEN = 2
        BLUE = 3

`_old_convert_` works much like` _convert_` does, using the original logic:

    # in a test file
    import socket, enum
    CheckedAddressFamily = enum._old_convert_(
            enum.IntEnum, 'AddressFamily', 'socket',
            lambda C: C.isupper() and C.startswith('AF_'),
            source=_socket,
            )

`_test_simple_enum` takes a traditional enum and a simple enum and
compares the two:

    # in the REPL or the same module as Color
    class CheckedColor(Enum):
        RED = 1
        GREEN = 2
        BLUE = 3

    _test_simple_enum(CheckedColor, Color)

    _test_simple_enum(CheckedAddressFamily, socket.AddressFamily)

Any important differences will raise a TypeError
2021-04-21 10:20:44 -07:00
Ethan Furman 503cdc7c12
Revert "bpo-38659: [Enum] add _simple_enum decorator (GH-25285)" (GH-25476)
This reverts commit dbac8f40e8.
2021-04-19 19:12:24 -07:00
Ethan Furman dbac8f40e8
bpo-38659: [Enum] add _simple_enum decorator (GH-25285)
add:

_simple_enum decorator to transform a normal class into an enum
_test_simple_enum function to compare
_old_convert_ to enable checking _convert_ generated enums
_simple_enum takes a normal class and converts it into an enum:

@simple_enum(Enum)
class Color:
    RED = 1
    GREEN = 2
    BLUE = 3

_old_convert_ works much like _convert_ does, using the original logic:

# in a test file
import socket, enum
CheckedAddressFamily = enum._old_convert_(
        enum.IntEnum, 'AddressFamily', 'socket',
        lambda C: C.isupper() and C.startswith('AF_'),
        source=_socket,
        )

test_simple_enum takes a traditional enum and a simple enum and
compares the two:

# in the REPL or the same module as Color
class CheckedColor(Enum):
    RED = 1
    GREEN = 2
    BLUE = 3

_test_simple_enum(CheckedColor, Color)

_test_simple_enum(CheckedAddressFamily, socket.AddressFamily)

Any important differences will raise a TypeError
2021-04-19 18:04:53 -07:00
Cheryl Sabella 6713e869c4
bpo-33289: Return RGB triplet of ints instead of floats from tkinter.colorchooser (GH-6578) 2021-01-21 21:14:04 +02:00
Serhiy Storchaka 1df56bc059
bpo-42759: Fix equality comparison of Variable and Font in Tkinter (GH-23968)
Objects which belong to different Tcl interpreters are now always
different, even if they have the same name.
2020-12-29 12:56:55 +02:00
Serhiy Storchaka c1ae21c965
Rename Tkinter tests for widget options (GH-23944)
Every test for widget option starts now with "test_configure_"
to distinguish it from tests for widget commands.
2020-12-26 00:10:29 +02:00
Desmond Cheong 36a779e64c
bpo-35728: Add root parameter to tkinter.font.nametofont() (GH-23885) 2020-12-25 23:18:06 +02:00
Serhiy Storchaka 675c97eb6c
bpo-42721: Improve using simple dialogs without root window (GH-23897)
When simple query dialogs (tkinter.simpledialog), message boxes
(tkinter.messagebox) or color choose dialog (tkinter.colorchooser)
are created without arguments master and parent, and the default
root window is not yet created, a new temporary hidden root window
will be created automatically. It will not be set as the default root
window and will be destroyed right after closing the dialog window.
It will help to use these simple dialog windows in programs which do
not need other GUI.

Previously, message boxes and color chooser created the blank root
window and left it after closing the dialog window, and query dialogs
just raised an exception.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-12-25 20:19:20 +02:00
Serhiy Storchaka 3d569fd6dc
bpo-42630: Improve error reporting in Tkinter for absent default root (GH-23781)
* Tkinter functions and constructors which need a default root window
  raise now RuntimeError with descriptive message instead of obscure
  AttributeError or NameError if it is not created yet or cannot
  be created automatically.

* Add tests for all functions which use default root window.

* Fix import in the pynche script.
2020-12-19 12:17:08 +02:00
Serhiy Storchaka 5f0fe8ec70
bpo-19733: Re-enable tests for -image option in Tkinter (GH-23785) 2020-12-16 12:31:49 +02:00
Serhiy Storchaka f3c3ea91a7
bpo-42328: Skip some tests with themes vista and xpnative on Windows 7 (GH-23612) 2020-12-03 10:48:26 +02:00
Serhiy Storchaka 6cc2c419f6
bpo-42142: Try to fix timeouts in ttk tests (GH-23474)
Instead of using wait_visibility() which waits event <VisibilityNotify> in dead loop
use update() which should proceed all queued events.
2020-11-30 10:24:07 +02:00
Serhiy Storchaka b0b428510c
bpo-42370: Check element before making mouse click in ttk tests (GH-23491) 2020-11-24 19:35:39 +02:00
Serhiy Storchaka dd844a2916
bpo-42328: Fix tkinter.ttk.Style.map(). (GH-23300)
The function accepts now the representation of the default state as
empty sequence (as returned by Style.map()).
The structure of the result is now the same on all platform
and does not depend on the value of wantobjects.
2020-11-22 22:48:52 +02:00
Anatoliy Platonov b4d895336a
bpo-41876: Overload __repr__ for tkinter Font objects (GH-22450) 2020-10-14 13:02:51 +03:00
Serhiy Storchaka f25323a307
bpo-41831: Add tests for tkinter.Event.__repr__ (GH-22354) 2020-10-09 21:45:46 +03:00
E-Paine aecf036738
bpo-41306: Allow scale value to not be rounded (GH-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](591f68cb38) and means that the arguments listed above are rounded relative to the value of `from`. However, when rounding the `from` argument ([line 623](591f68cb38/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
2020-10-08 06:30:13 -07:00
Hai Shi 79bb2c93f2
bpo-40275: Use new test.support helper submodules in tests (GH-21743) 2020-08-06 13:51:29 +02:00