[ltk-user] Just one frame?

Peter Herth herth at peter-herth.de
Thu Apr 26 15:49:42 UTC 2007


Hi Johnny,

On 4/26/07, Johnny Zackrisson <jz at student.chalmers.se> wrote:
>
>
> hi.
>
> i've tryied to play with more dynamic aspects of the
> integration with ltk. now, i can use wish and fire of
> 'pack's for different objects, and wish will nicely
> display the new object within the current frame/window.
>
> when i try to do the same with ltk, i always get a new
> window/frame with the object inside it. i don't want this
> behaviour and it seems like ltk automatically adds some
> extra parameters to the call. i've tried a lot of ways,
> but haven't managed to get this working. there seems to
> be some magic behind the "master" slot, etc, and maybe
> it's the default behaviour that is my problem?

I am not completely sure what your problem is, please for future
questions, always include the offending Tcl or Lisp code, it makes it
more likely to point out to solutions.
However, I induce that you did something like:
button .frame.mybutton
in Tcl to have the button appear within .frame - in Ltk you would
replace this with something like:
(setf button (make-instance 'button :master frame ..))
assuming frame is the Ltk widget for your frame you want to put your
button in. So nothing magical in the master slot but expressing the
same parent-child relationship that the Tcl pathname to a widget does.


> serve-event seems needed to get rid of the "main-loop"
> thing (which annoys me incredibly). and while that works,
> it still do not display a new object, that's been asked
> to be displayed later on, within the same frame as before.
>
> anyone know how to get this working?
>
> by the way, i noticed that the examples is hooking into
> the main-loop with "with-ltk" without further arguments
> - is this just a compatibility thing for lisps without
> serve-event or threads?
>
> i've never designed guis before, but i want to "communicate"
> with the gui-subsystem of my application, not get hooked
> into it. i wanna say, "add this to window X now" and "add
> this handler for button y", without further interruptions.
> i don't want my lisp to be tight up in some -- seemingly --
> very badly designed main-loop thing; i want protocol exchange
> and buffered communication.
>
> am i approaching this the wrong way?

Most likely :)
I am again not sure what exactly your problem with mainloop is, but it
is only for event processing. The only difference with respect to
serve-event is, that it kind of puts the event processing in the
background, that is parallelizing it. The only use of that is, that
you keep your lisp REPL responsive while running the ltk application.
In a lisp with threads, you can just spawn the whole ltk application
in a thread of its own.
In any way, this is only about event dispatching and has no influence
how the GUI is rendered. Unless you need to run another task in the
background (like reading data from a serial port) the default
behaviour is what you want. If not, I can tell you more detailled
later on, how to do it elsewise.

I hope this helps, but if not, don't heasitate to ask for more
detaills, but please attach the corresponding code :)

Peter



More information about the ltk-user mailing list