您的位置:首页 > 编程语言 > Python开发

Tkinter 8.5 参考手册: a GUI for Python (五)11 窗口的名称

2016-01-02 19:28 711 查看
http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/window-names.html

5.11. Window names

The term window describes a
rectangular area on the desktop.

A top-level or
root window is a window that
has an independent existence under the window
manager. It is decorated with the window manager's
decorations, and can be moved and resized
independently. Your application can use any number
of top-level windows.

The term “window” also applies to any
widget that is part of a top-level window.

Tkinter names all these windows using a hierarchical
window path name.

The root window's name is
'.'
.

Child windows have names of the form
'.
n
'
, where
n
[/code] is some integer
in string form. For example, a window named
'.135932060'
is a child of the root window
(
'.'
).

Child windows within child windows have names of the
form
'
p
.[code]n
'[/code] where
p
[/code] is the name of
the parent window and
n
[/code] is some
integer. For example, a window named
'.135932060.137304468'
has parent window
'.135932060'
, so it is a grandchild of
the root window.

The relative name of a window
is the part past the last
'.'
in the
path name. To continue the previous example, the
grandchild window has a relative name
'137304468'
.

To get the path name for a widget
w
[/code], use
str(
w
)
.

See also Section 26, “Universal widget methods” for methods you can
use to operate on window names, especially the
.winfo_name
,
.winfo_parent
, and
.winfo_pathname
methods.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: