Hi,<br>I'm trying to create an animation with words based on the (ltktest) function in the library (rotate).<br>For that I'm storing the words in a plist. The code to maintain the words is:<br><br>(defvar *initial-word-energy* 100)<br>
(defvar *words* '()) ; list of words in the form (:text :x :y :energy)<br><br>(defun make-word (text x y display-item)<br>  (list :text text :x x :y y :display-item display-item :energy *initial-word-energy*))<br><br>
(defun add-word (word) (push word *words*))<br><br><br>Then I created a button that will add words to the plist and to the canvas:<br><br>           (enter-text-button (make-instance 'button <br>                                             :master controls <br>
                                             :text "Enter text"<br>                                             :command (lambda ()<br>                                                        ;;store word in *words*<br>
                                                        (let*  ((text (text user-text-entry))<br>                                                                (x (random (read-from-string <br>                                                                           (cget drawing-canvas-reference <br>
                                                                                             :width))))<br>                                                                (y (random (read-from-string <br>                                                                           (cget drawing-canvas-reference <br>
                                                                                             :height))))<br>                                                                ;;put text in canvas<br>                                                                (display-item (create-text drawing-canvas-reference<br>
                                                                                           x<br>                                                                                           y<br>                                                                                           text))<br>
                                                                (word (make-word<br>                                                                       text<br>                                                                       x<br>
                                                                       y<br>                                                                       display-item)))<br>                                                          <br>
                                                          ;;store new word<br>                                                          (add-word word)<br>                                                          <br>                                                          ;;clear entry widget<br>
                                                          (setf (text user-text-entry) "")<br>                                                          (focus user-text-entry)<br>                                                          (finish-output)))))<br>
<br><br>The idea is that a word will store the position, the text, other things and the visual representation of the text.<br><br>In the animation part (same code as rotate in the library) I move the words, and here is the problem.<br>
If I try the move changing the coordinates of the updated values of x and y of the word the text apearing in the canvas 'jumps' in the first move, afterward it move normally.<br>The other alternative is to use itemmove, which works. but I would like to just manipulate x and y of the word and transpose it to the created text item in the canvas.<br>
<br>     ;;move display item<br>    [do not work] ---> (set-coords *drawing-canvas-reference* (getf word :display-item) (list (getf word :x) (getf word :y)))<br>    [works]         ----> (itemmove *drawing-canvas-reference* (getf word :display-item) atract-x atract-y)<br>
<br>So, I would like to understand better why there seems to be a difference in the values of x an y for the element stored and the element displayed, although they have been created with the same values.<br>If possible, I would like to know how can I query the created text element about it's x and y values.<br>
<br>Sorry for the long message.<br>Any help is appreciated.<br>Thanks,<br>André<br><br><br>