I want a function to create a LTK frame/canvas that lets it persist in the background. The function then updates the LTK frame/canvas through other functions as it does some other work.
What I have so far is the following two functions and one global variable:
(defvar *my-canvas*)
(defun initialize-window (...)
(with-ltk (:serve-event t )
(setq *my-canvas* (make-instance 'canvas))
(let ((c *my-canvas*))
...draw some objects on the canvas...
(pack c))
(defun update-window (...)
(with-ltk ()
(let ((c *my-canvas*))
...do something with the canvas...)))
I call these functions from a separate function:
(defun visualize (...)
... do something ...
(initialize-window ...)
... do something more ...
(update-window ...))
initialize-window
works without issues. But whenever I call the update-window
function, I run into a Tcl/Tk error: invalid command name ".wc"
error from (ltk::read-data)
called by any functions in the "do something with the canvas" part.
What is the recommended way to get update-window
to work without issues?