[New-bugs-announce] [issue41632] Tkinter - Unexpected behavior after creating around 10000 widgets

Jonathan Lahav report at bugs.python.org
Tue Aug 25 08:23:41 EDT 2020

New submission from Jonathan Lahav <j.lahav at gmail.com>:

After creating around 10000 widgets (verified with ttk.Label), no more widgets get created, and sometimes graphical artifacts appear outside the application window.

No error message or exception is raised.

Either the limit can be removed (having dynamically created 10000 widgets in data heavy applications is sometimes desired), or at least document and return runtime errors to prevent the weird behavior.

This is the problematic part:
for _ in range(10000):
    ttk.Label(root, text='problematic')

A full minimal example code is attached, though a better effect can be seen when running the above two lines in the context of a more advanced Tkinter application.

components: Tkinter
files: ten_k.py
messages: 375888
nosy: gpolo, j.lahav, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Tkinter - Unexpected behavior after creating around 10000 widgets
type: crash
versions: Python 3.8
Added file: https://bugs.python.org/file49426/ten_k.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list