[New-bugs-announce] [issue46117] tk could not refresh auto in mac os

asper report at bugs.python.org
Fri Dec 17 09:27:10 EST 2021


New submission from asper <asper at 21cn.com>:

from tkinter import *
from tkinter import ttk


def change():
    global flag
    if flag == 1:
        namelbl.grid_remove()
        namelbl2.grid(column=0, row=0)
        entry2.grid(column=1, row=0, sticky=(W, E))
        flag = 2
    elif flag == 2:
        namelbl2.grid_remove()
        namelbl.grid()
        flag = 1


root = Tk()
root.columnconfigure(1, weight=1)

namelbl = ttk.Label(root, text="Name")
namelbl2 = ttk.Label(root, text="Name2")
entry1 = ttk.Entry(root)
entry2 = ttk.Entry(root)

ok = ttk.Button(root, text="change", command=change)
ok.grid(column=1, row=1)
namelbl.grid(column=0, row=0)
entry1.grid(column=1, row=0, sticky=(W, E))
flag = 1

root.mainloop()

I run the script in mac os 12.1, use python3.10 download from python.org. when the main window show, I change it's size, and press the   "change" button, the script change the label'text from "Name" to "Name2".When press the button again, the label'text from "Name2" to "Name". but the label cannot refresh the text, it show nothing. when I move the mouse, the text showed immediately. 
The script run normally on windows system.
I use the grid_remove() and grid() to switch frame.

----------
assignee: terry.reedy
components: IDLE
messages: 408780
nosy: asper, terry.reedy
priority: normal
severity: normal
status: open
title: tk could not refresh auto in mac os
type: behavior
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46117>
_______________________________________


More information about the New-bugs-announce mailing list