python / python/cpython

Tkinter text widget scrolling uncontrollably under Wayland

Open
#131,029 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

OS-linux stdlib topic-tkinter type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

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.

https://github.com/user-attachments/assets/964159fa-afdf-4885-ac74-d39ae003302c

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Start by running the minimal Tkinter example on GNOME with Wayland, then compare resizing and scrolling under X using the reported reproduction steps. Done means resizing no longer forces the Text widget to the bottom or overrides user scrolling on Wayland.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.