JW | 16 Dec 2012 02:19
Picon

Can't get SCALE value

I am having two problems with SCALE.  

1. I cannot set bounds to anything other than integers.  For example:
(make-instance 'scale :from 0 :to (* 2 pi) ...
gives me an error.

2. I am unable to retrieve the :VARIABLE value

In the below, vales of UPPER-THETA and FORE-THETA never seem to be anything but 
0, no matter where I slide the scale.  I have tested all the drawing an update 
code, I am stumped!

(defun controltest ()
  "Test of a user-controlled robot arm"
  (with-ltk ()
    (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) #|ms|# )
(Continue reading)

Jason Miller | 7 Dec 2012 17:45

Bug in LTK

LTK constructs names for tcl variables by appending characters to "w"
the problem is that there is a command "wm" already in tcl/tk.  This can
cause issues.  I quickly worked around it by making the base-name "ww"
as there are no built-in commands that start with ww.  However the right
solution is probably to make a namespace.

-Jason

Josef Wolf | 21 Nov 2012 12:41
Picon

Using tags on canvas items?

Hello everybody,

I am trying to use the tags feature of the canvas. So I am trying to attach a
list of tags to an item and use those tags later to identify items. Here's an
example:

 (with-ltk ()
   (let* ((sc (make-instance 'scrolled-canvas))
          (canvas (canvas sc))
          (polygon (create-polygon canvas '(10 20 30 40 60 50))))

     (pack sc)
     (configure canvas :width 100 :height 100)

     (itemconfigure canvas polygon :tags '(foo bar baz))
     (itemconfigure canvas polygon :fill 'red)
     (itemconfigure canvas 'foo    :fill 'yellow)))

But it somehow doesn't work the way I expected it to work. The polygon stays
red instead of being re-configured to yellow.

It also won't work if I use strings instead of symbols. It only works if I use
a _single_ string. But this is not how the tags feature is intended to work.

Any ideas?

Josef Wolf | 19 Nov 2012 18:10
Picon

Increamentally build the GUI?

Hello everybody,

I am trying to build my tk GUI incrementally. The SERVE-EVENT parameter seems
to suggest that something like the following should be possible:

  (defvar *frame*)
  (defvar *label-widget*)

  (with-ltk (:serve-event t)
    (setf *frame* (make-instance 'frame))
    (pack *frame*))

  (with-ltk (:serve-event t)
    (setf *label-widget* (make-instance
                          'label
                          :master *frame*
                          :text "initial text"))
    (pack *label-widget* :side :left))

  (with-ltk ()
     ;; All initializations are already done, we just need to enter MAINLOOP
     )

But instead of a single toplevel containing both, the frame and the label, I
get two separate toplevels. And none of those toplevels seem to contain the
label widget. The output of the ps command shows, that two separate WISH
processes are started, which obviously is not going to work.

Does anybody have an example of how to properly use the SERVE-EVENT parameter?

(Continue reading)

Josef Wolf | 19 Nov 2012 17:29
Picon

How to configure widgets?

Hello everybody,

I am trying to make my first steps with ltk, and I have problems to
reconfigure existing widgets. Here is an example where I try to reconfigure
the :TEXT attribute of the LABEL-WIDGET widget whenever the checkbox of the
CHECK-BUTTON-WIDGET widget is clicked.

 (with-ltk ()
   (setf *debug-tk* t)
   (let* ((f (make-instance 'frame))
          (label-widget (make-instance 'label
                         :master f
                         :text "initial text"))
          (check-button-widget (make-instance 'check-button
                                :master f
                                :text "check me"
                                :command (lambda (val)
                                           (configure label-widget :text val)))))
     (pack f)
     (pack label-widget :side :left)
     (pack check-button-widget :side :left)
     (configure f :borderwidth 3)
     (configure f :relief :sunken)))

When I click on the checkbox, the col.or of the checkbox changes and I can see
in the debug output something like this:

 process_buffer
 l:(:CALLBACK "we" 1)<=
 buffer size 27
(Continue reading)

David Peebles | 10 Nov 2012 18:33
Picon

Updating the canvas

Hi everyone,

I'm trying to update the canvas at regular intervals as currently it only does so once my program has
finished.  I know there's a Tk 'update' command have been unable to find an example of its use in LTk.  I'd be
very grateful if someone could tell me if it is possible to use this command in LTk and if so, how to do it.

Many thanks,

David

---
David Peebles PhD
Reader in Cognitive Science,
Department of Behavioural and Social Sciences,
University of Huddersfield
Queensgate, Huddersfield, HD1 3DH

---
This transmission is confidential and may be legally privileged. If you receive it in error, please notify
us immediately by e-mail and remove it from your system. If the content of this e-mail does not relate to the
business of the University of Huddersfield, then we do not endorse it and will accept no liability.

haruichi yabuki | 9 Nov 2012 02:33
Picon

run-time error => Invalid initialization argument: :FONT

Hi, ltk-users,

I am very much troubled by the following situation.
Can someone help me?

The program below gives the error message at run-time:

>  Invalid initialization argument:
>    :FONT
>  in call for class #<STANDARD-CLASS BUTTON>.
>  See also:
>    The ANSI Standard, Section 7.1.2
>    [Condition of type INITARG-ERROR]

The program is as follos:
-------------------------------------------------------------
(asdf:operate 'asdf:load-op :ltk :verbose nil)
(defpackage :ltk-user
  (:use :common-lisp :cl-user :ltk))
(in-package :ltk-user)
(with-ltk ()
  (wm-title *tk* "an example of button")
  (bind *tk* "<Alt-q>" (lambda (event) (setf *exit-mainloop* t)))
  (let ((btn (make-instance 'button
                            :master nil
                            :text "BUTTON"
                            :font "verdana 20"
                            :command (lambda ()
                                       (format t "the button is pushed.~%")
                                       (setf *exit-mainloop* t)))))
(Continue reading)

Nikita B. Zuev | 1 Nov 2012 16:46
Picon

listbox api

Hello,

I'm having a little trouble with usage of a listbox in LTK library,
and would appreciate some assistance.

Documentation states that there is a LISTBOX class
http://www.peter-herth.de/ltk/ltkdoc/node25.html
but nothing about how to manipulate its contents.

Google have helped me to find LISTBOX-APPEND to add items and
LISTBOX-GET-SELECTION to
retrieve selection. Thing here is LISTBOX-GET-SELECTION returns list
of indices, not actual items,
and nothing in google says about where to apply index to get actual
selected item.
That is easy to workaround by using a separate variable to store list
of items and pushing to it
after adding item to LISTBOX instance, then getting selection from
LISTBOX and getting selected
item from this variable by index, but I have a feeling that I'm doing
it wrong, and overcomplicating
things.

Also docs say
http://www.peter-herth.de/ltk/ltkdoc/node15.html
:COMMAND initarg can be used to handle LISTBOX's selection change event, but
(MAKE-INSTANCE 'LISTBOX :command (lambda () ... )) fails saying it has
no such initarg,
well BIND works, so its ok probably.

(Continue reading)

harven | 30 Sep 2012 23:12
Picon
Favicon

two beginner questions (iterate over children / X_cursor)

Hi, 

I am working through the tk tutorial using ltk
http://www.tkdocs.com/tutorial/firstexample.html
One of the first examples is a feet-to-meter converter.

At some point, the padding of the widgets is set by looping through
the children of the mainframe.

  foreach w [winfo children .c] {grid configure $w -padx 5 -pady 5}

Q1: How can I do this with ltk ? Is there a function that returns the list 
of the children of a widget ?

Q2: The *cursor* variable lists "X_cursor" as its first element, but tk 
reports an error. 

  (with-ltk nil 
     (pack (make-instance 'button
                       :text "some" :cursor "X_cursor" :width 15)))

 => Tcl/Tk error: bad cursor spec "x_cursor"

This is the sole cursor in *cursor* that produces an error.
I am using gnu/linux on debian squeeze stable and tk 8.5.

Finally, here is my attempt at building the converter. It seems to work, I welcome
any comments or advices. 

(defun calculate (arg)
(Continue reading)

harven | 1 Sep 2012 03:19
Picon
Favicon

problem with the :background keyword

Hi,

I am a beginner at both ltk and tk and I am trying to convert a small programme
from Tk to LTk.

Tk version:
pack [button .b -text "Push Me" -background red -command {tk_messageBox -message "hello, world"}]

LTk version:
(with-ltk () 
  (let ((my-button
         (make-instance 'text :text "Push Me"
                        :background :red
                        :command
                        (lambda () (message-box "Hello, world!" "message"
                                                'ok 'info)))))
    (pack my-button)))

The Tk version works fine, whereas the LTk version gives the following error:

  Invalid initialization argument:
    :BACKGROUND
  in call for class #<STANDARD-CLASS BUTTON>.
  See also:
    The ANSI Standard, Section 7.1.2
    [Condition of type INITARG-ERROR]

On the other hand, there is no error if the :background line is removed.
It's as if the :background keyword is only allowed for a few specific widgets,
like the text widget. I also get errors if I try to set it with configure,
(Continue reading)

Peter Herth | 26 Jul 2012 13:46
Picon
Favicon

stupid cow...

http://www.ksta.de/berggemeinden/eingeklemmt-eine-wirklich-dumme-kuh,15189216,16722700.html


Gmane