【发布时间】:2012-12-03 14:01:50
【问题描述】:
我正在 AMD64 机器上使用 SBCL for Linux。 函数 CONTROL-TEST 使用绘图 CANVAS 和两个滑动 SCALE 创建一个窗口。 UPPER-SLIDER 和 FORE-SLIDER 的滑块 :VARIABLES 应该分别绑定到 UPPER-THETA 和 FORE-THETA,但更新代码只看到 0。我已经在另一个函数中测试了更新代码。
(defun controltest ()
"Test of a user-controlled robot arm"
(with-ltk ()
; (make-instance 'scale :master fscale :from 0 :to 100 :length 150 )
(let* ((upper-theta 0) (fore-theta 0)
(upper-slider
(make-instance 'scale :from 0 :to 7
:length 360 :variable upper-theta))
(fore-slider
(make-instance 'scale :from 0 :to 7
:length 360 :variable fore-theta))
(cnvs (make-instance 'canvas :width cnvs-width :height cnvs-height))
(upper (manip:uctk-beam :cen-x 200 :cen-y 200
:b-length 40 :b-width 20
:tk-cnvs cnvs))
(fore (manip:uctk-beam :cen-x 0 :cen-y 40 ; relative to upper
:b-length 40 :b-width 20
:tk-cnvs cnvs))
(slp-time 50))
(labels ((update ()
(draw upper nil) ; contains FORE, no need to draw separately
(geo:set-member-theta upper 2 fore-theta)
(geo:set-theta upper upper-theta)
(after slp-time #'update)))
(geo:add-geo upper fore) ; make FORE a member of UPPER
(pack cnvs :fill :both :expand 1)
(pack upper-slider :side :bottom)
(pack fore-slider :side :bottom)
(update)))))
【问题讨论】:
-
也许,你的问题是你只调用了一次更新,而不是在滑块事件上调用它?
-
@VsevolodDyomkin ,从文档和源代码中,我看不到属于此类的更新功能。据我所知,这会更新所有其他小部件的每次重绘。
标签: linux common-lisp x86-64 sbcl ltk