From: Hidetoshi NAGAI Date: 2010-02-03T09:30:08+09:00 Subject: Re: TK: Get the "usable" screensize"? From: Axel Subject: TK: Get the "usable" screensize"? Date: Tue, 2 Feb 2010 03:55:24 +0900 Message-ID: <371e3d52-02e8-4d9a-8b2b-61aa440e3e65@v25g2000yqk.googlegroups.com> > I found http://wiki.tcl.tk/11291 which points into the > same direction, but I cannot use it with success (it's TCL). FYI, Ruby/Tk can use Tcl scripts. For example, ------------------------------------------------------------------------- Tk.ip_eval < \ width height decorationLeft decorationTop set contentsTop [winfo rooty $w] set contentsLeft [winfo rootx $w] # Measure left edge, and assume all edges except top are the # same thickness set decorationThickness [expr {$contentsLeft - $decorationLeft}] # Find titlebar and menubar thickness set menubarThickness [expr {$contentsTop - $decorationTop}] incr width [expr {2 * $decorationThickness}] incr height $decorationThickness incr height $menubarThickness return [list $width $height $decorationLeft $decorationTop] } EOS Tk.ip_eval < e.g. "220 72 0 0" TkComm.simplelist(Tk.tk_call("totalGeometry")) #=> e.g. ["220", "72", "0", "0"] TkComm.list(Tk.tk_call("totalGeometry")) #=> e.g. [220, 72, 0, 0] TkComm.tk_tcl2ruby(Tk.tk_call("totalGeometry")) #=> e.g. [220, 72, 0, 0] Tk.tk_call_to_simplelist("totalGeometry")) #=> e.g. ["220", "72", "0", "0"] Tk.tk_call_to_list("totalGeometry")) #=> e.g. [220, 72, 0, 0] top = TkToplevel.new Tk.tk_call("totalGeometry", top) #=> e.g. "230 104 0 0" Tk.tk_call("taskbar") #=> e.g. "47" TkComm.number(Tk.tk_call("taskbar")) #=> e.g. 47 TkComm.tk_tcl2ruby(Tk.tk_call("taskbar")) #=> e.g. 47 ------------------------------------------------------------------------- Also, please see an example ext/tk/sample/tktree.rb and tktree.tcl on Ruby's source tree. -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)