我正在尝试生成一个小程序,以便更好地理解tkinter在python中的工作方式。在
因此,我想知道如何设置一个图标并更新tkinter窗口的标题。在
我已经写了下面的代码,有人能建议我如何在这个脚本中实现上述目标?在
from Tkinter import *
import Tkinter as Tk
import ttk
class Test(Tk.Tk):
def __init__(self, *args, **kwargs):
Tk.Tk.__init__(self, *args, **kwargs)
app = Test()
app.state("zoomed")
app.mainloop()
# I'm having problems with this could I get any help?
app.wm_iconbitmap('xxxxxxx.ico')
app.title('Vikings Lore')
您可以使用以下代码段设置tkinter窗口的标题:
这将把根窗口的标题设置为
^{pr2}$Hello, world
。 至于图标,可以使用以下代码段设置:这将把根窗口的图标设置为文件
icon.ico
。在如果你需要进一步的基本帮助,tkinter http://effbot.org/tkinterbook/是你最好的朋友。在
相关问题 更多 >
编程相关推荐