Tcl/Tk:最大化窗口/确定窗口是否最大化?
我能否查明我的顶层窗口是否已最大化,以及是否可以通过编程方式将其最大化?我在 Windows XP 上使用 R 的 tcltk 包 8.5。
问题的原因是:我想通过先调用撤回然后取消图标来强制
事件。但是,如果窗口在这两个函数调用之前最大化,则在这两个函数调用之后窗口不会最大化。有没有更简单的方法来执行该事件?
Can I find out if my toplevel window is maximized, and can I maximize it programmatically? I am using R's tcltk package 8.5 on Windows XP.
The reason for the question is: I want to enforce a <Visibility>
event by calling first withdraw and then deiconify. However, if the window was maximized before these two function calls, it is not after these calls. Is there an easier way to enforce the event?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以通过
wm state $toplevel
发现窗口是否最大化(查找zoomed
作为返回值)。但是……操作系统无法在 Windows 上正确生成
事件;你只能在被映射的窗口上获得它们,这是微妙的不同。 (与 X 相比,Windows 告诉您的有关堆栈顺序及其后果的信息要少得多;Tk 非常接近 X 的模型。)不过,您没有说明为什么想要此事件;也许还有其他东西可以满足您的真正目的?You can discover the whether the window is maximized with
wm state $toplevel
(look forzoomed
as a return value). But…The OS doesn't generate
<Visibility>
events properly for you on Windows; you only get them on the window being mapped, and that's subtly different. (Windows tells you much less about the stacking order and its consequences than X does; Tk's pretty close to X's model.) You don't say why you want this event though; perhaps there's something else that will serve your real purpose?编写了一个函数,将可见性事件传播到给定的小部件及其所有子部件。
这样,我不需要调用withdraw/deiconify并将我的事件发送到每个小部件。
Wrote a function that propagates the Visibility event to a given widget and all its children.
This way, I don't need to call withdraw/deiconify and get my event to each widget.