The docs included in the commit do the best job of describing this.
Much discussion on the PR and issue.
thank you to to core team folks jaraco, emmatyping, gpshead, and all others who added their constructive comments along the way.
---------
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Verify the virtual events that widgets emit in response to user
interaction, driven by generated events: <<ListboxSelect>> (Listbox),
<<Increment>> and <<Decrement>> (ttk Spinbox), and <<TreeviewSelect>>,
<<TreeviewOpen>> and <<TreeviewClose>> (ttk Treeview).
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Wrap the Tk text widget "sync" and "pendingsync" subcommands, which
control and report the synchronization of the displayed view with the
underlying text when line heights have not yet been computed.
Drive the modal query dialogs with generated events to exercise the
<Return> and <Escape> key bindings and the value validation: accepting
an integer, float or string, cancelling, rejecting a non-numeric value
and rejecting a value outside the allowed range.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Cover Misc.wait_variable and wait_window, tk_focusFollowsMouse,
selection_handle, the error paths of grab_set_global, send, the
X11-specific Wm methods iconposition, iconmask, iconwindow,
colormapwindows and manage/forget, and the Text.window_config alias and
deprecated yview_pickplace.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Exercise the native dialogs (Open, SaveAs and Directory) through the
_test_callback seam without opening them, and test the pure-Python
FileDialog selection, filter and ok/cancel logic without entering its
modal loop.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Drive the drag-and-drop protocol (dnd_start and the DndHandler enter/
motion/commit, leave/cancel and end callbacks).
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Wrap the Tk text widget "edit canundo" and "edit canredo" subcommands,
which report whether the undo and redo stacks are non-empty.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a test for the ScrolledText widget, which had no tests: that it is
a Text widget held in a Frame with a Scrollbar, that Text methods work,
that the geometry manager methods are redirected to the frame while
configure is not, and that the scrollbar tracks the text view.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* font: copy(), the config alias, the displayof argument of measure and
metrics, and the errors raised for invalid options and a wrong number
of arguments;
* image: the cget method and the config alias, and the errors raised by
transparency_get and transparency_set;
* variable: that initialize is an alias of set and the deprecated trace
is an alias of trace_variable;
* Misc: tk_focusNext, tk_focusPrev, tk_strictMotif, tk_bisque and
option_readfile;
* Wm: wm_iconphoto.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Wrap the ncurses nofilter() function, which undoes the effect of
filter(). Without it there is no way to restore normal screen sizing
after a curses.filter() call in the same process.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cover previously-untested methods of the Misc, Wm, Pack, Place and Grid
classes:
* a new WinfoTest class for the winfo_* query methods (class, name,
parent, children, toplevel, visual and screen information, atoms,
pointer and screen coordinates, fpixels, containing, interps,
viewable), including the pre-existing winfo_rgb and winfo_pathname;
* in MiscTest: getint, getdouble, getvar, register, deletecommand,
option_add/get/clear, nametowidget, the focus_*, grab_* and
selection_own* methods, event_add/delete/info, and bell;
* in WmTest: title, geometry, minsize/maxsize, resizable, aspect, grid,
positionfrom/sizefrom, focusmodel, iconname, client/command,
overrideredirect, state (with withdraw and deiconify), frame, group,
protocol and transient;
* the short-named aliases of the grid_*, pack_* and place_* geometry
manager methods.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Tcl/Tk 9 may embed the Tk script library in the Tk DLL on Windows. This embedded library is not found by Tcl by default.
Mount the loaded Tk DLL as a zipfs archive before calling Tk_Init(), so Tk can find its embedded tk_library using its existing library discovery logic.
Preserve Tk_Init()'s normal path if the library is not embedded.
Make the curses tests portable to other curses implementations
Guard the chgat() check (chgat() needs wchgat()) and stop assuming a
subpad shares the parent pad's cells (implementation-defined in X/Open).
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cover previously-untested methods of several widgets:
* Button, Checkbutton and Radiobutton: invoke, flash and toggle;
* Entry: delete, icursor and the select_* aliases;
* Spinbox: invoke, identify and scan;
* Scale and Scrollbar: identify, and Scrollbar fraction and delta;
* PanedWindow: panes, remove/forget, sash and proxy positioning,
identify, and adding panes with configuration options.
Also test that invoke does nothing for a disabled button and the
errors raised for invalid indices, coordinates, option names and values.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add curses tests for panels, textpad, and window behavior
Extend test_curses with behavior-verifying tests that go beyond the
existing smoke tests:
* curses.panel stacking: new_panel/top/bottom/above/below ordering,
hide/show/hidden, move, replace and userptr round-trip.
* Real-window curses.textpad.Textbox: gather(), edit(), stripspaces,
insert mode and the Emacs-like editing commands (previously only
exercised through a MagicMock).
* Window output: addstr cursor advance and addnstr truncation,
insstr/insnstr shifting without cursor movement, and pad behavior
(instr, subpad cell sharing, the required 6-argument refresh()).
* Error handling: out-of-range coordinates raising curses.error and
bad character/string argument types.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cover previously-untested Canvas methods in CanvasTest:
* item creation and types, bbox, coordinate conversion, move/scale,
find and addtag queries, tags, item configuration, stacking order,
text-item editing, selection, focus, scan and postscript;
* the create_arc, create_oval, create_bitmap, create_image,
create_text and create_window item creation methods, checking
coordinates, default and explicit options, valid enumerations and
rejection of invalid values;
* tag_bind() and tag_unbind(), checking the returned function id and
binding script, querying bound sequences, the add parameter, event
delivery to items via a tag, and removal of a single binding by id
or all bindings for a sequence.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cover previously-untested Listbox methods in ListboxTest: size, delete,
index resolution, nearest, see, activate, and the selection methods
(selection_set/clear/includes/anchor and their select_* aliases),
including the errors raised for invalid indices.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cover previously-untested Menu methods in MenuTest: adding, inserting and
deleting items of every type, index resolution, invoking items, entry x/y
positions, and post/unpost/tk_popup mapping.
Also test per-entry configuration options and the errors raised for
invalid indices, entry types, option names and option values.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add frozendict to the fast paths of PyMapping_GetOptionalItem(),
PyMapping_Keys(), PyMapping_Values(), and PyMapping_Items().
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
The module-global curses_screen_encoding stored a borrowed pointer to the
encoding owned by the window returned by the first initscr() call. That
window can be deallocated while unctrl() and ungetch(), which have no window
of their own, still use the pointer to encode non-ASCII characters.
Keep a private copy of the encoding instead.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cover previously-untested Text methods (indices, content, marks, tags,
undo/redo, dump, embedded images and windows, peers, and geometry) and
the tag, embedded-image and embedded-window configuration options.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Frozendict has `_Py_TPFLAGS_MATCH_SELF` set so works correctly
with the single-arg class matching. However it isn't documented
in the list of classes this works with and it isn't tested.
The test is some way below the other similar tests but anything
else would need a large renumbering.
Replace the previously sparse reference documentation with full coverage of
the public API of the tkinter package, written from the Tcl/Tk manual pages,
the existing documentation and the module docstrings.
* Doc/library/tkinter.rst gains a "Reference" section documenting every public
class, method, function and constant of the core module -- the widgets, the
Misc, Wm, Pack, Place, Grid, XView and YView mix-ins, the Variable and image
classes, the module-level functions and the symbolic constants.
* Doc/library/tkinter.ttk.rst, dialog.rst, tkinter.font.rst and the other
module pages document their remaining classes, methods and functions.
The descriptions are Python-oriented (correct return types -- tuples rather
than Tcl lists, booleans, integers, None on cancellation, and so on) and were
checked against the Tcl/Tk 9.1 manual pages and the implementation.
versionadded, versionchanged and deprecated directives are added for the
public API, determined from the git history relative to Python 3.0: the
tkinter.ttk module (3.1); the Text, Wm, Menu and Misc methods exposing Tk 8.5
features (3.3); and the many later additions and behavior changes up to 3.15.
The Tk version required by features added after Tk 8.6 is noted as well. The
bundled Tcl/Tk version is updated to 9.0 and the manual-page links point at
the tcl9.0 reference.
--------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
The initial implementation of PEP 820 worsened the error message
when non-types are given as base types in Py_tp_bases & Py_tp_base.
Bring back the 'bases must be types' wording and add a 'got' note for
easier debugging.
Improve slot ID documentation, and soft-deprecate Py_tp_base
(as per the PEP).
Use a timeout of 15 minutes for --tsan command and a timeout of 10
minutes for --tsan-parallel command. Display also the slowest tests
to help adjusting these timeouts later if needed.