LTK 按钮高度不可配置
LTK button height not configurable
我在 Common Lisp 中使用 LTK 作为基础 windows。我想创建一个方形按钮,但结果无法更改高度。这是代码的相关部分:
(let ((tile (make-instance 'button
:width 20
:height 20))))
我遇到一个错误:
Invalid initialization argument:
:HEIGHT
in call for class #<STANDARD-CLASS LTK:BUTTON>.
See also:
The ANSI Standard, Section 7.1.2
[Condition of type INITARG-ERROR]
在 LTK documentation 中,高度被列为可配置的按钮。安装有问题还是已知错误或什么?
我认为 ltk 方面缺少它。在 Slime 中使用 M-.
,我转到按钮的定义:
(defargs button (widget)
command
compound
default
image
state
textvariable
underline
width)
确实没有height
,也不是来自widget
。
我在 nodgui(带有语法糖和更多元小部件的 ltk 分支)上询问,因为维护者真的很好:https://notabug.org/cage/nodgui/issues/6
他的回答:
nodgui 仅支持使用 'ttk' 主题引擎的小部件:
https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_intro.htm
ttk::button 的文档:
https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_button.htm
没有显示高度参数(如果我错了请纠正我)
(您是否有机会查看 https://www.tcl.tk/man/tcl8.6/TkCmd/button.htm?这是非 ttk 版本的小部件,不受支持)
可能您可以使用 frame 和 sticky 属性来修改按钮的几何形状(从未尝试过),而且我不知道以像素为单位指定按钮大小的方法。
希望这个帮助ps 有所帮助! :)
ps:可能重要的是要指出小部件部分的 LTK 文档已过时。
需要考虑的其他信息:https://mailman.common-lisp.net/pipermail/ltk-user/2016-June/000625.html
Tcl/Tk up to 8.4
including allowed the font for buttons to be set. From 8.5 there was the
ttk widget set, which at some point became the default for ltk. The ttk
widget set uses a theme engine to determine many of the rendering
parameters for widgets to achieve a "native" look. This means that a lot of
older options for the widgets got removed. You can find the documentation
for the widget here: https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_button.htm
If you push :tk84 onto features, you get the old style widgets, otherwise
you can of course create/modify ttk themes, that should give you the
ability to configure fonts too. With bug reports like this, it also would
be very helpful if you included information about the operation system the
problem shows, the lisp you are using Ltk with, and in this case, a screen
shot.
我在 Common Lisp 中使用 LTK 作为基础 windows。我想创建一个方形按钮,但结果无法更改高度。这是代码的相关部分:
(let ((tile (make-instance 'button
:width 20
:height 20))))
我遇到一个错误:
Invalid initialization argument:
:HEIGHT
in call for class #<STANDARD-CLASS LTK:BUTTON>.
See also:
The ANSI Standard, Section 7.1.2
[Condition of type INITARG-ERROR]
在 LTK documentation 中,高度被列为可配置的按钮。安装有问题还是已知错误或什么?
我认为 ltk 方面缺少它。在 Slime 中使用 M-.
,我转到按钮的定义:
(defargs button (widget)
command
compound
default
image
state
textvariable
underline
width)
确实没有height
,也不是来自widget
。
我在 nodgui(带有语法糖和更多元小部件的 ltk 分支)上询问,因为维护者真的很好:https://notabug.org/cage/nodgui/issues/6
他的回答:
nodgui 仅支持使用 'ttk' 主题引擎的小部件:
https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_intro.htm
ttk::button 的文档:
https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_button.htm
没有显示高度参数(如果我错了请纠正我)
(您是否有机会查看 https://www.tcl.tk/man/tcl8.6/TkCmd/button.htm?这是非 ttk 版本的小部件,不受支持)
可能您可以使用 frame 和 sticky 属性来修改按钮的几何形状(从未尝试过),而且我不知道以像素为单位指定按钮大小的方法。
希望这个帮助ps 有所帮助! :)
ps:可能重要的是要指出小部件部分的 LTK 文档已过时。
需要考虑的其他信息:https://mailman.common-lisp.net/pipermail/ltk-user/2016-June/000625.html
Tcl/Tk up to 8.4 including allowed the font for buttons to be set. From 8.5 there was the ttk widget set, which at some point became the default for ltk. The ttk widget set uses a theme engine to determine many of the rendering parameters for widgets to achieve a "native" look. This means that a lot of older options for the widgets got removed. You can find the documentation for the widget here: https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_button.htm
If you push :tk84 onto features, you get the old style widgets, otherwise you can of course create/modify ttk themes, that should give you the ability to configure fonts too. With bug reports like this, it also would be very helpful if you included information about the operation system the problem shows, the lisp you are using Ltk with, and in this case, a screen shot.