This is the (useless) error message I got on Windows 10 :
File "C:\Users\Michel\Python\Textplo\textplo2_3b4v8.py", line 80, in initUI
bold_font = font.Font(self.text, nfont)
File "C:\Users\Michel\AppData\Local\Programs\Python\Python310\lib\tkinter\font.py", line 78, in __init__
font = tk.splitlist(tk.call("font", "actual", font))
AttributeError: 'str' object has no attribute 'splitlist'. Did you mean: 'splitlines'?
(the dot in |.| stands for « main » or « root » in Tkinter)
Suggested patch : I included a modified v3.10.7 font.py (see modified block below) in a separate local directory to give it precedence and my Tkinter application now loads and runs like a charm in Python v3.10.7.
ifnotroot: #my own included modified local font.pyroot=tkinter._get_default_root('use font')
tk=getattr(root, 'tk', root)
print(f"root= |{root}|") # result: root= |.|
== eof ===
The text was updated successfully, but these errors were encountered:
I have fixed the markup and indentations in your message to make it readable.
If I understood you correctly, you suggest to use not root instead of root is None, reverting bpo-15303 in this code. The only difference between these codes is when root has a false boolean value, but not None. The error message brings us to the conclusion that it is an empty string. Looks like there is a bug in your code -- self.text is "" instead of a Text widget.
Thank you so much, Serhiy, for your quick reply.
Right on! I changed |self.text = ""| to |self.text = None|. Now, my script loads and runs well under 3.10.7.
I though that |""| was all right to initialize a text variable, but, obviously, this isn't good enough for 3.10.7.
Oddly, some other minor bugs are now showing up in my script due to an included legacy file. It looks like 3.10.7 may break older code (3.2 or 3.3). The good news is that these bugs are easy to fix thanks to the enhanced error messages of 3.10.7.
This is the (useless) error message I got on Windows 10 :
This is the error-generating block in font.py:
Normal working code in earlier versions:
(the dot in |.| stands for « main » or « root » in Tkinter)
Suggested patch : I included a modified v3.10.7 font.py (see modified block below) in a separate local directory to give it precedence and my Tkinter application now loads and runs like a charm in Python v3.10.7.
== eof ===
The text was updated successfully, but these errors were encountered: