## Tcl8.6.17/Tk8.6.17 Documentation > Tk Commands > winfo

### Tcl/Tk Applications | Tcl Commands | Tk Commands | [incr Tcl] Package Commands | SQLite3 Package Commands | TDBC Package Commands | tdbc::mysql Package Commands | tdbc::odbc Package Commands | tdbc::postgres Package Commands | tdbc::sqlite3 Package Commands | Thread Package Commands | Tcl C API | Tk C API | [incr Tcl] Package C API | TDBC Package C API

  NAME
    winfo — 窓関連情報を返す Return window-related information
  構文 SYNOPSIS
  説明 DESCRIPTION
    winfo atom ?-displayof window? name
    winfo atomname ?-displayof window? id
    winfo cells window
    winfo children window
    winfo class window
    winfo colormapfull window
    winfo containing ?-displayof window? rootX rootY
    winfo depth window
    winfo exists window
    winfo fpixels window number
    winfo geometry window
    winfo height window
    winfo id window
    winfo interps ?-displayof window?
    winfo ismapped window
    winfo manager window
    winfo name window
    winfo parent window
    winfo pathname ?-displayof window? id
    winfo pixels window number
    winfo pointerx window
    winfo pointerxy window
    winfo pointery window
    winfo reqheight window
    winfo reqwidth window
    winfo rgb window color
    winfo rootx window
    winfo rooty window
    winfo screen window
    winfo screencells window
    winfo screendepth window
    winfo screenheight window
    winfo screenmmheight window
    winfo screenmmwidth window
    winfo screenvisual window
    winfo screenwidth window
    winfo server window
    winfo toplevel window
    winfo viewable window
    winfo visual window
    winfo visualid window
    winfo visualsavailable window ?includeids?
    winfo vrootheight window
    winfo vrootwidth window
    winfo vrootx window
    winfo vrooty window
    winfo width window
    winfo x window
    winfo y window
  用例 EXAMPLE
  KEYWORDS

### NAME

winfo — 窓関連情報を返す Return window-related information

### 構文 SYNOPSIS

winfo option ?arg arg ...?

### 説明 DESCRIPTION

winfo 命令は Tk に管理されている窓に関する情報の取り出しに使用される｡ option 引数に依存するどのような数の異なる形式をもとり得る｡適正な形式は次の通り: The winfo command is used to retrieve information about windows managed by Tk. It can take any of a number of different forms, depending on the option argument. The legal forms are:

winfo atom ?-displayof window? name
  名前が name の基本子の整数識別子を与える十進文字列を返す｡ name という名前の基本子がない場合､新しいものが作成される｡もし -displayof 指示項目が与えられた場合､基本子は window の表示上を検索される; それ以外の場合､応用譜の主の窓の表示上が検索される｡ Returns a decimal string giving the integer identifier for the atom whose name is name. If no atom exists with the name name then a new one is created. If the -displayof option is given then the atom is looked up on the display of window; otherwise it is looked up on the display of the application's main window.

winfo atomname ?-displayof window? id
  整数識別子が id の基本子の文字的名前を返す｡もし -displayof 指示項目が与えられた場合､識別子は window の表示上を検索される､それ以外の場合､応用譜の主の窓の表示上を検索される｡この命令は winfo atom の逆である｡この様な基本子が存在しない場合不具合を生成する｡ Returns the textual name for the atom whose integer identifier is id. If the -displayof option is given then the identifier is looked up on the display of window; otherwise it is looked up on the display of the application's main window. This command is the inverse of the winfo atom command. It generates an error if no such atom exists.

winfo cells window
  window に関する画素地図内の小区画の数を与える十進文字列を返す｡ Returns a decimal string giving the number of cells in the color map for window.

winfo children window
  window の全ての子供の経路名を含むリストを返す｡頂上水準の窓は論理的な子供の親として返される｡このリストは低い窓程早い棚順である､但し棚順に返されない頂上水準の窓は例外である｡頂上水準の窓の棚の順は wm stackorder 命令を使って問合せされたい｡ Returns a list containing the path names of all the children of window. Top-level windows are returned as children of their logical parents. The list is in stacking order, with the lowest window first, except for Top-level windows which are not returned in stacking order. Use the wm stackorder command to query the stacking order of Top-level windows.

winfo class window
  window に関する級の名前を返す｡ Returns the class name for window.

winfo colormapfull window
  window に関する色地図が満杯であることが判っていると 1 を､それ以外は 0 を返す｡窓に関する色地図が､満杯であることが “判っている” のは､ 窓に関する新しい色の割付の最新の試みが失敗し､且つ､この応用譜が色地図内のどの色も失敗した割付以降に取除いていない場合である｡ 　　　 Returns 1 if the colormap for window is known to be full, 0 otherwise. The colormap for a window is “known” to be full if the last attempt to allocate a new color on that window failed and this application has not freed any colors in the colormap since the failed allocation.

winfo containing ?-displayof window? rootX rootY
  rootX と rootY で与えられる位置を含む窓の名前を返す｡ rootX と rootY は根本窓の座標系内に画面単位で(即ち､ Tk_GetPixels に受入れられるどの形式でも)指定される(もし仮想根本窓管理譜が使用中の場合､仮想根本窓の座標系が使われる)｡もし､ -displayof 指示項目が与えられる場合､座標は window を含む画面を参照する; それ以外の場合､応用譜の主なる窓の画面を参照する｡もしその点を含む応用譜内に窓がない場合､空文字列が返される｡含んでいる窓の選択では親より子供に高い優先順序が与えられ､兄弟の間では棚の順序で最高の優先度のものが撰ばれる｡ Returns the path name for the window containing the point given by rootX and rootY. RootX and rootY are specified in screen units (i.e. any form acceptable to Tk_GetPixels) in the coordinate system of the root window (if a virtual-root window manager is in use then the coordinate system of the virtual root window is used). If the -displayof option is given then the coordinates refer to the screen containing window; otherwise they refer to the screen of the application's main window. If no window in this application contains the point then an empty string is returned. An empty string is also returned if the point lies in the title bar or border of its highest containing toplevel in this application. (Note that with some window managers the borders may be invisible.) In selecting the containing window, children are given higher priority than parents and among siblings the highest one in the stacking order is chosen.

winfo depth window
  window の深さを与える十進文字列を返す(画素当りのビット数)｡ Returns a decimal string giving the depth of window (number of bits per pixel).

winfo exists window
  window と謂ふ名前の窓が実在する場合 1 ､そのような窓が存在しない場合 0 を返す｡ [訳註 0,1の論理値については if 命令を参照されたい] 　　　　 Returns 1 if there exists a window named window, 0 if no such window exists.

winfo fpixels window number
  window 内で number によって与えられる距離に見合った画素の数を与える浮動小数を返す｡ number は Tk_GetScreenMM によって受入れられるどのような形式で指定してもよい､譬えば “2.0c” や “1i” ｡ 返る値は小数かもしれない; 整数が欲しい場合は winfo pixels を使われたい｡ Returns a floating-point value giving the number of pixels in window corresponding to the distance given by number. Number may be specified in any of the forms acceptable to Tk_GetScreenMM, such as “2.0c” or “1i”. The return value may be fractional; for an integer value, use winfo pixels.

winfo geometry window
  window の幾何を widthxheight+x+y の形式で返す｡全ての寸法は画素単位｡ Returns the geometry for window, in the form width x height+x+y. All dimensions are in pixels.

winfo height window
  window の高さを画素単位で与える十進文字列を返す｡窓が最初に作成される時その高さは１画素になる; 窓の要求を満たすよう高さは幾何管理譜により最終的に変更される｡ もし､部品を作成した直後に高さの幅を必要とする場合は､幾何管理譜に整えさえる為に update を起動するか､実際の高さの代りに要求された窓の高さを得るための winfo reqheight を使はれたい｡ 　　　 Returns a decimal string giving window's height in pixels. When a window is first created its height will be 1 pixel; the height will eventually be changed by a geometry manager to fulfil the window's needs. If you need the true height immediately after creating a widget, invoke update to force the geometry manager to arrange it, or use winfo reqheight to get the window's requested height instead of its actual height.

winfo id window
  window に関する低水準のOS固有の識別子を与える十六進文字列を返す｡ Unix 上ではこれは X 窓識別子である｡Windows 上ではWindows HWND である｡マッキントッシュ上では Tk の外では意味を成さない値である｡ Returns a hexadecimal string giving a low-level platform-specific identifier for window. On Unix platforms, this is the X window identifier. Under Windows, this is the Windows HWND. On the Macintosh the value has no meaning outside Tk.

winfo interps ?-displayof window?
  特定の表示画面の為に現在登録されている全てのTcl 解釈実行機能の名前(譬えば全ての Tk-使用の応用譜)を要素にしたリストを返す｡ -displayof 指示項目が与えられた場合､返る値は window の表示を参照し;与えられない場合応用譜の主の窓の表示を参照している｡ Returns a list whose members are the names of all Tcl interpreters (e.g. all Tk-based applications) currently registered for a particular display. If the -displayof option is given then the return value refers to the display of window; otherwise it refers to the display of the application's main window.

winfo ismapped window
  もし window が現在対応付けされていると 1 それ以外は 0 を返す｡ Returns 1 if window is currently mapped, 0 otherwise.

winfo manager window
  現在 window を担当している幾何管理譜の名前を返すが､ window がどの幾何管理譜にも管理されていない場合は空文字列を返す｡名前は通常幾何管理譜のための Tcl 命令の名前である､譬えば pack や place の様な｡もし幾何管理譜が､譬えば画布や文書の様な部品の場合､名前は部品の級の命令､譬えば canvas になる｡ Returns the name of the geometry manager currently responsible for window, or an empty string if window is not managed by any geometry manager. The name is usually the name of the Tcl command for the geometry manager, such as pack or place. If the geometry manager is a widget, such as canvases or text, the name is the widget's class command, such as canvas.

winfo name window
  window の名前を返す(即ち､その親の中での名前､総経路名と対照的な方)｡命令 winfo name . は応用譜の名前を返す｡ Returns window's name (i.e. its name within its parent, as opposed to its full path name). The command winfo name . will return the name of the application.

winfo parent window
  window の親の経路名を返す､もし window が応用譜の主窓の場合は空文字列を返す｡ Returns the path name of window's parent, or an empty string if window is the main window of the application.

winfo pathname ?-displayof window? id
  X の識別子が id の窓の経路名を返す｡ id は十進か､十六進か､８進整数であり且つ起動している応用譜中の窓に対応していなければならない｡もし -displayof 指示項目が与えられると識別子は window の表示を検索する､それ以外の場合応用譜の主なる窓の表示上を検索する｡ Returns the path name of the window whose X identifier is id. Id must be a decimal, hexadecimal, or octal integer and must correspond to a window in the invoking application. If the -displayof option is given then the identifier is looked up on the display of window; otherwise it is looked up on the display of the application's main window.

winfo pixels window number
  window 内で number によって与えられる距離に見合った画素の数を返す｡ number は Tk_GetScreenMM によって受入れられるどのような形式で指定してもよい､譬えば “2.0c” や “1i” ｡返る値は最も近い整数に丸められる; 小数の結果に就いては winfo fpixels を使われたい｡ Returns the number of pixels in window corresponding to the distance given by number. Number may be specified in any of the forms acceptable to Tk_GetPixels, such as “2.0c” or “1i”. The result is rounded to the nearest integer value; for a fractional result, use winfo fpixels.

winfo pointerx window
  もしマウス指示子が window と同じ画面上にある場合､窓根本窓内で測定した画素単位の x 座標を返す｡もし仮想根本窓が画面上で使用されている場合は､位置は仮想根本内で測定される｡もしマウス指示子が window と同じ画面上にない場合は -1 が返される｡ If the mouse pointer is on the same screen as window, returns the pointer's x coordinate, measured in pixels in the screen's root window. If a virtual root window is in use on the screen, the position is measured in the virtual root. If the mouse pointer is not on the same screen as window then -1 is returned.

winfo pointerxy window
  もしマウス指示子が window と同じ画面上にある場合､窓根本窓内で測定した画素単位の x と y 座標の二つの要素からなるリストを返す｡もし仮想根本窓が画面上で使用されている場合は､位置は仮想根本内で測定される｡もしマウス指示子が window と同じ画面上にない場合は返される座標は両方とも -1 になる｡ If the mouse pointer is on the same screen as window, returns a list with two elements, which are the pointer's x and y coordinates measured in pixels in the screen's root window. If a virtual root window is in use on the screen, the position is computed in the virtual root. If the mouse pointer is not on the same screen as window then both of the returned coordinates are -1.

winfo pointery window
  もしマウス指示子が window と同じ画面上にある場合､窓根本窓内で測定した画素単位の y 座標を返す｡もし仮想根本窓が画面上で使用されている場合は､位置は仮想根本内で測定される｡もしマウス指示子が window と同じ画面上にない場合は -1 が返される｡ If the mouse pointer is on the same screen as window, returns the pointer's y coordinate, measured in pixels in the screen's root window. If a virtual root window is in use on the screen, the position is computed in the virtual root. If the mouse pointer is not on the same screen as window then -1 is returned.

winfo reqheight window
  window に要求された画素単位の高さを与える十進文字列を返す｡これは window の幾何管理譜により､その幾何形状を算出する為に使われる｡ Returns a decimal string giving window's requested height, in pixels. This is the value used by window's geometry manager to compute its geometry.

winfo reqwidth window
  window に要求された画素単位の幅を与える十進文字列を返す｡これは window の幾何管理譜により､その幾何形状を算出する為に使われる｡ Returns a decimal string giving window's requested width, in pixels. This is the value used by window's geometry manager to compute its geometry.

winfo rgb window color
  三つの 0 から 65535 の範囲の十進数を含むリストを返す､それは､ window で与えられる窓内の color の､赤､緑､青強度に相当する｡ color は色指示項目の為に受入れられるどのような形式で指定しても良い｡ Returns a list containing three decimal values in the range 0 to 65535, which are the red, green, and blue intensities that correspond to color in the window given by window. Color may be specified in any of the forms acceptable for a color option.

winfo rootx window
  画面の根本窓内の､ window の境界の(境界がない場合は window の)左上隅の x-座標を与える十進数列を返す｡ Returns a decimal string giving the x-coordinate, in the root window of the screen, of the upper-left corner of window's border (or window if it has no border).

winfo rooty window
  画面の根本窓内の､ window の境界の(境界がない場合は window の)左上隅の y-座標を与える十進数列を返す｡ Returns a decimal string giving the y-coordinate, in the root window of the screen, of the upper-left corner of window's border (or window if it has no border).

winfo screen window
  window に結合した画面の名前を displayName.screenIndex の形式で返す｡ Returns the name of the screen associated with window, in the form displayName.screenIndex.

winfo screencells window
  window の画面の為の省略時設定の画素地図内の小部屋の数を与える十進文字列を返す｡ Returns a decimal string giving the number of cells in the default color map for window's screen.

winfo screendepth window
  window の画面の根本窓の深さを与える十進文字列を返す(画素当りのビットの数)｡ Returns a decimal string giving the depth of the root window of window's screen (number of bits per pixel).

winfo screenheight window
  window の画面の高さを画素単位で与える十進文字列を返す｡ Returns a decimal string giving the height of window's screen, in pixels.

winfo screenmmheight window
  window の画面の高さをミリ単位で与える十進文字列を返す｡ Returns a decimal string giving the height of window's screen, in millimeters.

winfo screenmmwidth window
  window の画面の幅をミリ単位で与える十進文字列を返す｡ Returns a decimal string giving the width of window's screen, in millimeters.

winfo screenvisual window
  window の窓の省略時設定の外観級を指し示す､次の中の文字列の内の一つによる: directcolor か grayscale か pseudocolor か staticcolor か staticgray か truecolor ｡(訳註: Inter-Client Communication Conventions Manual(ICCCM) による色付け法｡) Returns one of the following strings to indicate the default visual class for window's screen: directcolor, grayscale, pseudocolor, staticcolor, staticgray, or truecolor.

winfo screenwidth window
  window の画面の幅を画素単位で与える十進文字列を返す｡ Returns a decimal string giving the width of window's screen, in pixels.

winfo server window
  window の表示の為の集中管理機能に関する情報を含む文字列を返す｡この文字列の正確な書式はOS毎に異なる｡ X 集中管理機能のでは､文字列は “XmajorRminor vendor vendorVersion” であり､ここで major と minor は集中管理機能に与えられる版番号と改訂番号(譬えば､ X11R5)､ vendor は集中管理機能の供給社､ vendorRelease は集中管理機能により与えられる出版番号である｡ Returns a string containing information about the server for window's display. The exact format of this string may vary from platform to platform. For X servers the string has the form “X major R minor vendor vendorVersion” where major and minor are the version and revision numbers provided by the server (e.g., X11R5), vendor is the name of the vendor for the server, and vendorRelease is an integer release number provided by the server.

winfo toplevel window
  window を含む窓の頂上の階層の経路名を返す｡標準 Tk では､これは常に頂上水準toplevelの部品であるが､拡張譜では他の種類の頂上の階層部品のことがある｡ Returns the path name of the top-of-hierarchy window containing window. In standard Tk this will always be a toplevel widget, but extensions may create other kinds of top-of-hierarchy widgets.

winfo viewable window
  もし window とその全ての祖先が最も近い頂上水準の窓まで対応付けされていれば 1 を返す｡もしこれ等の窓のどれかが対応付けされていなければ 0 を返す｡ Returns 1 if window and all of its ancestors up through the nearest toplevel window are mapped. Returns 0 if any of these windows are not mapped.

winfo visual window
  window に関する外観の級を指し示す､次の中の文字列の内の一つを返す: directcolor か grayscale か pseudocolor か staticcolor か staticgray か truecolor ｡ Returns one of the following strings to indicate the visual class for window: directcolor, grayscale, pseudocolor, staticcolor, staticgray, or truecolor.

winfo visualid window
  window に関する可視の為の X 識別子を返す｡ Returns the X identifier for the visual for window.

winfo visualsavailable window ?includeids?
  window の画面の為に利用できる外観の記述を要素にもつリストを返す｡外観の級からなるそれぞれの要素は整数の深さが続く｡その級は winfo visual に返されるものと同じ形式を有する｡その深さは外観中の画素当りのビット数を与える｡更に､もし includeids 引数が与えられている場合､その深さに外観の為の X による識別子が続く｡ Returns a list whose elements describe the visuals available for window's screen. Each element consists of a visual class followed by an integer depth. The class has the same form as returned by winfo visual. The depth gives the number of bits per pixel in the visual. In addition, if the includeids argument is provided, then the depth is followed by the X identifier for the visual.

winfo vrootheight window
  window に結合した仮想根本窓があればその高さを返す; ない場合は window の画面の高さを返す｡ Returns the height of the virtual root window associated with window if there is one; otherwise returns the height of window's screen.

winfo vrootwidth window
  window に結合した仮想根本窓があればその幅を返す; ない場合は window の画面の幅を返す｡ Returns the width of the virtual root window associated with window if there is one; otherwise returns the width of window's screen.

winfo vrootx window
  window に結合した仮想根本窓の､画面の根本窓の相対的な x-偏差を返す｡これは通常零か負である｡ window に対する仮想的根本窓がない場合 0 を返す｡ Returns the x-offset of the virtual root window associated with window, relative to the root window of its screen. This is normally either zero or negative. Returns 0 if there is no virtual root window for window.

winfo vrooty window
  window に結合した仮想根本窓の､画面の根本窓の相対的な y-偏差を返す｡これは通常零か負である｡ window に対する仮想的根本窓がない場合 0 を返す｡ Returns the y-offset of the virtual root window associated with window, relative to the root window of its screen. This is normally either zero or negative. Returns 0 if there is no virtual root window for window.

winfo width window
  window の幅を与える十進数文字列を返す｡窓が最初に作成される時その幅は 1 画素である; 幅は最後に幾何管理譜により窓の要求を果たす為に変更される｡もし､部品を作成した直後に真の幅を必要とする場合､幾何管理譜に整えさえる為に update を起動するか､実際の幅の代りに要求された窓の幅を得るために winfo reqwidth を使われたい｡ Returns a decimal string giving window's width in pixels. When a window is first created its width will be 1 pixel; the width will eventually be changed by a geometry manager to fulfil the window's needs. If you need the true width immediately after creating a widget, invoke update to force the geometry manager to arrange it, or use winfo reqwidth to get the window's requested width instead of its actual width.

winfo x window
  window の親の中での window の左上隅の境界の(境界がない場合は window の) x-座標を与える十進数文字列を返す｡ Returns a decimal string giving the x-coordinate, in window's parent, of the upper-left corner of window's border (or window if it has no border).

winfo y window
  window の親の中での window の左上隅の境界の(境界がない場合は window の) y-座標を与える十進数文字列を返す｡ Returns a decimal string giving the y-coordinate, in window's parent, of the upper-left corner of window's border (or window if it has no border).

### 用例 EXAMPLE

マウス指示子がある位置と､現在どの窓上にあるかを印刷する: Print where the mouse pointer is and what window it is currently over:

    lassign [winfo pointerxy .] x y
    puts -nonewline "Mouse pointer at ($x,$y) which is "
    set win [winfo containing $x $y]
    if {$win eq ""} {
        puts "over no window"
    } else {
        puts "over $win"
    }

### KEYWORDS

atom, children, class, geometry, height, identifier, information, interpreters, mapped, parent, path name, screen, virtual root, width, window
Copyright © 1990-1994 The Regents of the University of California.
Copyright © 1994-1997 Sun Microsystems, Inc.