【问题标题】:What is the difference between the title() method and wm_title() method in the Tkinter class?Tkinter 类中的 title() 方法和 wm_title() 方法有什么区别?
【发布时间】:2016-06-28 00:35:47
【问题描述】:

我正在使用 Python 2.7,我想知道 Tkinter 类的 title() 方法和 wm_title() 方法之间是否存在差异。以下代码:

import Tkinter as tk

root = tk.Tk()
root.title("My App")
root.mainloop()

import Tkinter as tk

root = tk.Tk()
root.wm_title("My App")
root.mainloop()

完成同样的事情。有什么隐藏的东西吗?

【问题讨论】:

  • 这是一个有两个名字的函数。

标签: python python-2.7 tkinter


【解决方案1】:

真的一样。 wm 方法用于与窗口管理器进行通信。因此 wm 用于窗口管理器。

Wm 类被根tk.Tk() 窗口用作mixin。您可以通过titlewm_title 和其他窗口管理器属性访问设置标题。

您可以查看文档here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-11-06
    • 1970-01-01
    • 2015-04-18
    • 1970-01-01
    • 1970-01-01
    • 2013-04-29
    • 2017-07-19
    • 1970-01-01
    相关资源
    最近更新 更多