为什么 Wish 打开两个窗口而不是一个?

发布于 2024-10-03 14:35:24 字数 270 浏览 0 评论 0原文

在 Tcl/Tk 中,文件 /usr/bin/wan27 的源中,

#! /usr/bin/wish -f
set w .main
toplevel $w
wm title $w "FOO"

当从终端 (Linux/Debian/Ubuntu 10.04) 发出命令“wan27”时,它会打开两个窗口,其中一个窗口的标题为 wan27另一个标题是“FOO”。我只想打开 FOO 窗口。我怎样才能实现这个目标呢?

谢谢

In Tcl/Tk, the source of file /usr/bin/wan27

#! /usr/bin/wish -f
set w .main
toplevel $w
wm title $w "FOO"

when issuing the command "wan27" from terminal (Linux/Debian/Ubuntu 10.04), it opens two windows, one with the title wan27 and the other one with the title FOO. I just want the FOO window to open. How can I fulfill that?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

赠意 2024-10-10 14:35:24

使用以下内容:

#! /usr/bin/wish -f
wm title . "FOO"

Use the following:

#! /usr/bin/wish -f
wm title . "FOO"
女皇必胜 2024-10-10 14:35:24

答案是wish总是创建一个名为“.”的窗口。这就是一扇窗户。然后,您使用 toplevel 命令创建第二个窗口,因此现在您有两个窗口。

The answer is that wish always creates a window named ".". So that is one window. You then create a second window with the toplevel command so now you have two.

街角卖回忆 2024-10-10 14:35:24

您还可以使用:

wm state . withdrawn

You can use also:

wm state . withdrawn
魂归处 2024-10-10 14:35:24

如果您想忽略 . 那么您可以隐藏它: wm iconify .

If you want to ignore . then you can just hide it: wm iconify .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文