Lors de l'exécusion d'un code python, le terminal me revoit l'erreur suivante:
python3 bidon.py
X Error of failed request: BadLength (poly request too large or internal Xlib length error)
Major opcode of failed request: 139 (RENDER)
Minor opcode of failed request: 20 (RenderAddGlyphs)
Serial number of failed request: 692
Current serial number in output stream: 786
Le programme python est correct et s'exécute sans souci sur windows. Après recherche il semble il y avoir un bug répertoriié :
https://bugs.launchpad.net/bugs/1852985
On en parle à plusieurs sur le net mais je n'ai pas saisi qu'elles sont les solutions apportées...
Voici le code qui recrée le bug:
import tkinter as tk
import tkinter.font as tkfont
from tkinter.scrolledtext import ScrolledText
root = tk.Tk()
frame = tk.LabelFrame(root, text="Polices")
frame.grid()
ft = tkfont.families()
txt = ScrolledText(frame, width=50, height=20)
txt.grid()
txt.insert("1.0", 'Polices:\n')
txt.tag_add("tagpolices", "1.0", "insert")
for i,f in enumerate(ft):
font = tkfont.Font(frame, size=20, family=f)
tag = f'tag{i}'
txt.tag_config(tag, font=font)
txt.insert("end", f, tag, '\n')
root.mainloop()
Je suis sous ubuntu 18.04 Mate.