Visitar URL original
tkinter [Windows] [Python 3.10] changing labelframe bg color causes whole window to be redrawn · Issue #102762 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20260521085807/https://github.com/python/cpython/issues/102762
Skip to content
/ cpython Public

tkinter [Windows] [Python 3.10] changing labelframe bg color causes whole window to be redrawn #102762

@ckelloug4

Description

@ckelloug4

On Windows 10 (x86-64), python 3.10.0 ,changing the bg color of a labelframe when the labelframe has width and height set and has a child label causes all widgets in the window to resize and redraw. This only happens on windows and not macOS and linux.

from tkinter import *
from tkinter import ttk
lf=[]
win=""
def change_color():
    for i in range(0,14):
        lf[i].config(bg="green")
    win.after(1000,change_color)

def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    global win
    win=Tk()
    global lf
    for i in range(0,14):
        lf.append(LabelFrame(win,text=f"frame {i}", width=100,height=100 ))
        Label(lf[i],text="foo").grid()
        lf[i].grid()

    win.after(1000,change_color)
    win.mainloop()

if __name__ == '__main__':
    print_hi('PyCharm')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions