如何最大化window?

How to maximize a window?

我已经找到方法 query whether a tk window is maximized:

library(tcltk)
w <- tktoplevel()
tkwm.state(w)  # Query the current state; returns "normal" if not maximized
#  The possible states for a window include "normal"m "iconic" (for an iconified window), "withdrawn", "icon" or "zoomed".
# For more details about window states see: http://www.tkdocs.com/tutorial/windows.html

如何最大化 tk window?

此代码无效(使用 Ubuntu 14.04):

tkwm.state(w, "zoomed")

Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : [tcl] bad argument "zoomed": must be normal, iconic, or withdrawn.

在 Linux 上,您必须使用 wm attributes 检查缩放状态。最大化代码与内部系统调用紧密相关,不跨平台兼容。

set iszoomed [wm attributes $w -zoomed]
wm attributes $w -zoomed 1 ; # set to maximized

抱歉,不知道它的 R 代码。