Skip to content

Tkinter text widget scrolling uncontrollably under Wayland #131029

Open
@johnohagan

Description

@johnohagan

Bug report

Bug description:

On Gnome with Wayland (current Debian testing), resizing a Tk root window to increase the height causes a contained Text widget to scroll uncontrollably to the bottom of the widget. If the widget is scrolled while this is happening, it keeps scrolling back to the bottom.

Resizing the window again by decreasing the height or changing the width, or clicking inside the text widget, usually stops the issue.

This happens with both the mouse scrollwheel and the tkinter scrollbar.

This doesn't happen on Gnome using X, or on Windows 10. I haven't tested on any other systems.

Minimal example:


from tkinter import *
from random import choice
from string import ascii_letters

root = Tk()
textwidget = Text(root)

for i in range(1000):
    textwidget.insert(END, f'{choice(ascii_letters)} ')

textwidget.pack(fill=BOTH, expand=True)
mainloop()

A screen-recording is attached using the above code and showing the issue, which occurs the third time the window is resized.

Screencast.From.2025-03-10.13-20-57.mp4

I have no idea how to debug this in more depth, any suggestions welcomed.

CPython versions tested on:

3.13

Operating systems tested on:

Linux, Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions