_tkinter.TclError when using Python 3.12 and 3.13 from Homebrew on macOS Sequoia 15.2 #5809
Unanswered
w8sl
asked this question in
Everyday usage
Replies: 2 comments 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
-
There’s a threading issue also. Here’s an example code that reproduces the crash (_tkinter.TclError: image type "photo" does not exist) with Homebrew’s Python 3.13 on Sequoia 15.2, but works with any Python 3.11 or 3.13 from python.org: (requires pillow) import os import tkinter as tk from PIL import Image, ImageTk import traceback import threading import queue class Example: def __init__(self, root): self.root = root self.photo = None self.queue = queue.Queue() self.image_label = tk.Label(root) self.image_label.pack() self.check_queue() # Start the image loading process in a separate thread threading.Thread(target=self.async_build_map_layer, args=(37, 23, 11, "OSM", self.queue)).start() def check_queue(self): try: photo = self.queue.get_nowait() self.update_image(photo) except queue.Empty: self.root.after(100, self.check_queue) def update_image(self, photo): self.photo = photo self.image_label.config(image=self.photo) self.image_label.image = self.photo # Keep a reference to avoid garbage collection @staticmethod def async_build_map_layer(lat, lon, zl, provider, output_queue): try: # Simulate loading an image file image_path = "absolute path to some .jpeg" background_map = Image.open(image_path) print("Image loaded successfully") # Simulate some processing delay import time time.sleep(2) photo = ImageTk.PhotoImage(background_map) output_queue.put(photo) except Exception as e: traceback.print_exc() raise e root = tk.Tk() app = Example(root) root.mainloop() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Output of
brew config
Output of
brew doctor
Description of issue
I get: _tkinter.TclError: bad option "variable": must be add, info, or remove, which is related to deprecated function: self.trace("w",..)
Correcting all occurrences in the source code of https://github.com/oscarpilote/Ortho4XP to: self.trace_add("write",..) doesn´t help! Still impossible to make previews and move the map. Unfortunately, it is very difficult to reproduce the issue with simple code example.
Interestingly, everything (as far as I can see) is ok on macOS Sequoia, with with Python 3.13 and 3.14 from python.org (self.trace("w",..) is accepted btw)
Beta Was this translation helpful? Give feedback.
All reactions