LTK按钮的高度不可配置 [英] LTK button height not configurable

查看:77
本文介绍了LTK按钮的高度不可配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将LTK用于Common Lisp中的基本窗口。我想创建一个方形按钮,但事实证明高度不能更改。这是代码的相关部分:

I'm using LTK for basic windows in Common Lisp. I want to create a square button, but it turns out that height can't be changed. Here's the relevant part of the code:

(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文档中,高度列为可配置的按钮。安装有问题吗?或者是已知的错误或什么?

In the LTK documentation, height is listed as configurable for buttons. Is there something wrong with the installation or is it a known bug or what?

推荐答案

我认为ltk方面缺少此功能。我在Slime中使用 M-。进入按钮的定义:

I think it is missing on ltk side. With M-. in Slime I go to the definition of button:

(defargs button (widget)
  command
  compound
  default
  image
  state
  textvariable
  underline
  width)

实际上并没有 height 并且没有来自 widget

There is no height indeed and it doesn't come from widget.

我向nodgui询问(带有语法糖和更多meta-widgets的ltk fork),因为维护人员真的很棒: https://notabug.org/cage/nodgui/issues/6

I asked on nodgui (ltk fork with syntax sugar and more meta-widgets) because the maintainer is real nice: https://notabug.org/cage/nodgui/issues/6

他的答案:

nodgui仅支持使用 ttk主题引擎的窗口小部件:

nodgui supports only the widget that use 'ttk' theme engine:

https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_intro.htm

文档对于ttk :: button:

the documentation for ttk::button:

https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_button.htm

没有显示高度参数(如果我错了,请纠正我)

shows no height parameter (correct me if I am wrong)

(是否有可能您正在查看 https://www.tcl.tk/man/tcl8.6/TkCmd/button.htm 吗?

(is there a chance that you are looking at https://www.tcl.tk/man/tcl8.6/TkCmd/button.htm ? This is the non-ttk version of the widget and is not supported)

可能是小部件的非ttk版本,也许您可​​以使用frame和sticky属性来修改按钮的几何形状(从未尝试过) ,此外,我不知道以像素为单位指定按钮大小的方法。

Probably you can play with frame and sticky attribute to modify the geometry of a button (never tried), moreover I do not know about a way to specify the size of a button in pixel units.

希望这会有所帮助! :)

Hope this helps someway! :)

ps:可能很重要的一点是要指出LTK文档在小部件中已过时。

ps: Probably is important to point out that the LTK documentation is outdated in the widget part.

要考虑的其他信息: https://mailman.common-lisp.net/pipermail/ltk-user/2016-June/000625.html


Tcl / Tk最高为8.4
,包括允许设置按钮的字体。从8.5开始,有
ttk小部件集,在某个时候它成为ltk的默认值。 ttk
小部件集使用主题引擎来确定小部件的许多呈现
参数,以实现本机外观。这意味着已删除了许多
个旧的小部件选项。您可以在此处找到该小部件的文档
https: //www.tcl.tk/man/tcl8.6/TkCmd/ttk_button.htm

如果将:tk84推入功能,您将获得旧样式的小部件,否则
当然可以创建/修改ttk主题,这也应该使您具备
来配置字体的能力。使用这样的错误报告,如果您包含有关
问题所显示的操作系统,正在使用Ltk的Lisp的信息,并且在这种情况下还包括屏幕$ b $,那么
也将非常有用。 b射击。

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.

这篇关于LTK按钮的高度不可配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆