unpack frame?
2012-04-27 15:02:34 GMT
Hi,
I am trying to write a small program that would do the following:
1. create a full screen window with no decorations
2. when the left mouse button is pressed, change the color of the window
according to the relative position (ie the color is calculated from the
position),
3. when the right mouse button is pressed, exit.
BTW, the application is for testing LCD screens.
I came up with the following:
(in-package :cl-user)
(require :ltk)
(use-package :ltk)
(defun hex-color (r g b)
"Return a hexadecimal color string. R G B should be in [0,1]."
(flet ((normalize (x)
(assert (<= 0 x 1))
(round (* x 255))))
(format nil "#~2,0x~2,0x~2,0x"
(normalize r)
(normalize g)
(normalize b))))
(defun lcd-test ()
(with-ltk ()
(let* ((canvas (make-instance 'canvas))
(down nil))
(flet ((set-color (x-rel y-rel)
(configure canvas "background"
(hex-color x-rel y-rel 0.5))))
(pack canvas)
(bind canvas "<ButtonPress-1>"
(lambda (evt)
(set-color (/ (event-x evt) (window-width canvas))
(/ (event-y evt) (window-height canvas)))
(setf down t)))
(bind canvas "<ButtonPress-2>"
(lambda (evt)
(declare (ignore evt))
(setf *exit-mainloop* t)))))))
However,
a. the application does not exit (maybe I am doing it wrong, I found
*exit-mainloop* in some examples),
b. I could not figure out how to make a full screen window,
c. when the window is resized, the canvas isn't (but of course with a
fullscreen window this would not be an issue).
Any help would be appreciated.
Tamas
Hello Is it possible to add an event in the ltk event queue from another thread ? I can put events in a queue and use (after ...) to read it periodically in the ltk thread, but it would be easier and more efficient to use the ltk event queue directly. Thank you Syll
Hello I have a few problems/questions with listbox selection (especially multiple selection). * If the listbox does'nt have the focus and I select items with Ctrl+click (including the first one), events from keys are not triggered for this listbox. Is it because the listbox has'nt get the focus at all ? How do i give the focus to the listbox (but not to any item) ? * If I understand this well, there are two special states that can be applied to list items : say "selected" (zero, one or several items) and "focused" (zero or one item). * I can select an item with listbox-select. How can I give the focus to an item ? * I catch selection events with <<ListboxSelect>>. How can I catch "item focus" events ? How can I get the focused item ? Thank you Syll
Hello I have tried to use scrolled-frame (which is not in the documentation but seem exist...). This code does not work : the program is frozen and the "wish" process uses all my CPU :s . (with-ltk () (let* ((p (make-instance 'scrolled-frame :master nil :pack '())) (txt (make-instance 'label :text "11" :master p :pack '(:side left)))))) Thank you for your help Syll Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ? Je crée ma boîte mail www.laposte.net _______________________________________________ ltk-user site list ltk-user <at> common-lisp.net http://common-lisp.net/mailman/listinfo/ltk-user
Hello I can't set the "bold" style to a label's font : (with-ltk () (make-instance 'label :text "..." :font '(:weight :bold) :pack '(:side :left))) (I've a similar error with 3 instead of :bold for example) -> "Tcl/Tk error: expected integer but got "BOLD)" How does it work ? Thank you Sylvain Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ? Je crée ma boîte mail www.laposte.net _______________________________________________ ltk-user site list ltk-user <at> common-lisp.net http://common-lisp.net/mailman/listinfo/ltk-user
I bumped into problems with SVN revision 261. It added tkescaping to
tk-princ, where there previously was none.
This change broke part of treeview-heading. A patch to make
treeview-heading work with the new tk-princ is attached.
example: (tk-princ "{stuff}")
old result: "{stuff}"
new result: "\{stuff\}"
new code for old result: (tk-princ '("stuff"))
The docstring for tk-princ says
"Like princ (format ~a), but convert a lisp list to a Tk list."
but the code is now very different.
Should the docstring change to match the new code, or should the code be
reverted to match the docstring?
Thanks,
Daniel
From 15dc5a09d1ad5b62df5eb559579f20ada7b2fa45 Mon Sep 17 00:00:00 2001
From: D Herring <dherring <at> at.tentpost.dot.com>
Date: Sun, 13 Nov 2011 22:43:39 -0500
Subject: [PATCH 1/2] fix treeview-heading
---
ltk/ltk.lisp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/ltk/ltk.lisp b/ltk/ltk.lisp
index 25ca182..9bb2b00 100644
--- a/ltk/ltk.lisp
+++ b/ltk/ltk.lisp
@@ -2872,7 +2872,7 @@ set y [winfo y ~a]
(let ((cbname (format nil "~a:~a" path column)))
(add-callback cbname command)
(setf (getf options :command)
- (concatenate 'string "{callback " cbname "}"))))
+ (list "callback" cbname))))
(format-wish "~a heading ~a~{ -~(~a~) ~/ltk::tk-princ/~}"
path column options))
(t ;; query
--
1.7.5.1
ok, I reinstalled everything and now it works ____________________________________________________________ TRY FREE IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if5 Capture screenshots, upload images, edit and send them to your friends through IMs, post on Twitter®, Facebook®, MySpace™, LinkedIn® – FAST! _______________________________________________ ltk-user site list ltk-user <at> common-lisp.net http://common-lisp.net/mailman/listinfo/ltk-user
hello to all I'd like to study LTK, but I got stuck at the very start I run "(load "e:/lisp/ltk/ltk-0.96/ltk")" ok, "(in-package :ltk)" ok, and then "(ltktest)": after a slight pause Emacs prints 0 and returns the prompt; no errors, then, but the problem is that nothing else happens! same thing if i run "(ltk::ltk-eyes)" I checked paths, etc (or so I think), and don't know what to do; in particular, I tried to modify ltk.lisp as follows: (defvar *wish-pathname* ; #+freebsd "wish8.4" ; #-freebsd "wish" "wish.exe") (defvar *debug-tk* t) my configuration: Windows Vista, ActiveState tcl/tk 8.5, the LispBox suite (CCL, Emacs, Slime), ltk-0.96 thanks in advance Claudio ____________________________________________________________ FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop! Check it out at http://www.inbox.com/earth
Hi,
I'm trying to create an animation with words based on the (ltktest) function in the library (rotate).
For that I'm storing the words in a plist. The code to maintain the words is:
(defvar *initial-word-energy* 100)
(defvar *words* '()) ; list of words in the form (:text :x :y :energy)
(defun make-word (text x y display-item)
(list :text text :x x :y y :display-item display-item :energy *initial-word-energy*))
(defun add-word (word) (push word *words*))
Then I created a button that will add words to the plist and to the canvas:
(enter-text-button (make-instance 'button
:master controls
:text "Enter text"
:command (lambda ()
;;store word in *words*
(let* ((text (text user-text-entry))
(x (random (read-from-string
(cget drawing-canvas-reference
:width))))
(y (random (read-from-string
(cget drawing-canvas-reference
:height))))
;;put text in canvas
(display-item (create-text drawing-canvas-reference
x
y
text))
(word (make-word
text
x
y
display-item)))
;;store new word
(add-word word)
;;clear entry widget
(setf (text user-text-entry) "")
(focus user-text-entry)
(finish-output)))))
The idea is that a word will store the position, the text, other things and the visual representation of the text.
In the animation part (same code as rotate in the library) I move the words, and here is the problem.
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.
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.
;;move display item
[do not work] ---> (set-coords *drawing-canvas-reference* (getf word :display-item) (list (getf word :x) (getf word :y)))
[works] ----> (itemmove *drawing-canvas-reference* (getf word :display-item) atract-x atract-y)
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.
If possible, I would like to know how can I query the created text element about it's x and y values.
Sorry for the long message.
Any help is appreciated.
Thanks,
André
| Mon | Tue | Wed | Thu | Fri | Sat | Sun |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
RSS Feed11 | |
|---|---|
5 | |
13 | |
1 | |
2 | |
7 | |
14 | |
13 | |
12 | |
1 | |
1 | |
5 | |
5 | |
3 | |
9 | |
4 | |
2 | |
3 | |
8 | |
8 | |
8 | |
12 | |
14 | |
11 | |
9 | |
10 | |
4 | |
9 | |
1 | |
2 | |
11 | |
3 | |
4 | |
11 | |
1 | |
1 | |
7 | |
11 | |
2 | |
12 | |
8 | |
2 | |
10 | |
2 | |
16 | |
1 | |
17 | |
5 | |
9 | |
13 | |
7 | |
4 | |
32 | |
5 | |
7 | |
11 | |
2 | |
16 | |
3 | |
22 | |
3 |