[New-bugs-announce] [issue46189] Text containing "wide" character not correctly refreshed

hejin517 report at bugs.python.org
Tue Dec 28 10:01:14 EST 2021


New submission from hejin517 <hejin517 at 126.com>:

When the app runs it first shows a black character "f" in Times New Roman.
By clicking the button, I expect that the color of the whole character will be changed to red, but actually only part is changed.

In FontForge (a font editor), I find the character "f" in Times New Roman is wider than its "width".
Please look into this problem. Thanks.

Code to reproduce:
----------------------
import tkinter

def change_color():
    canvas.itemconfig(text, fill="red")

root = tkinter.Tk()
canvas = tkinter.Canvas(root, width=500, height=500)
canvas.pack()

text = canvas.create_text((200, 200), text="f", font=("Times New Roman", 200), fill="black")

button = tkinter.Button(text="Change Color", command=change_color)
button.pack()

root.mainloop()

----------
components: Tkinter
messages: 409258
nosy: hejin517
priority: normal
severity: normal
status: open
title: Text containing "wide" character not correctly refreshed
type: behavior
versions: Python 3.8

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


More information about the New-bugs-announce mailing list