Reputation: 341
I'm starting to work on some GUI programming and decided to use ltk. Ltk stands for "lisp toolkit" and it provides a lispy syntax layer over the basic tcl / tk commands. It's a lot like Tkinter for python in a way.
I've however found that, when putting two canvasses in one frame and having one of them expand in both directions. That canvas doesn't expand pas halfway point of the screen.
To show what I mean, I'll provide some pictures. Here's the window just after creation.
When expanded it looks like this:
I'm now trying to get rid of the light gray area, but whatever I do, the left canvas doesn't seem to want to enter the right half of the screen.
I'm running this on linux mint, but that shouldn't matter to much. And I'm using the ltk version released on 2-2-2019. I've tried messing with the current keyword arguments, but I've gotten nothing to work.
Here's the code that results in these screens.
(in-package :ltk)
(defun scribble ()
(with-ltk ()
(let* ((frame (make-instance 'frame))
(canvas (make-instance 'canvas
:master frame
:background "white"))
(color-panel (make-instance 'canvas
:master frame
:width 400
:background "grey")))
(pack frame
:expand t
:fill :both)
(pack color-panel
:side :right
:expand t
:fill :y
:anchor :e)
(pack canvas
:side :left
:expand t
:fill :both
:anchor :w))))
;; To run the code, just run this function (in REPL or otherwise)
(scribble)
Upvotes: 3
Views: 219
Reputation: 341
I sort of figured it out. I'm still not completely sure how tk works, but from this other answer I got the information to fix it.
Tcl/Tk: Frames misbehave when resizing.
It took a sligth translation, but removing the :expand
option for the right panel managed to solve the issue. The new code now looks like this:
(in-package :ltk)
(defun scribble ()
(with-ltk ()
(let* ((frame (make-instance 'frame))
(canvas (make-instance 'canvas
:master frame
:background "white"))
(color-panel (make-instance 'canvas
:master frame
:width 400
:background "grey")))
(pack frame
:expand t
:fill :both)
(pack color-panel
:side :right
;; The :expand option has been removed!
:fill :y
:anchor :e)
(pack canvas
:side :left
:expand t
:fill :both
:anchor :w))))
This solves the problem presented.
Upvotes: 1