New submission from asper <as...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue46117>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to