Python easygui 编辑图标

问题描述 投票:0回答:1

我目前正在使用easygui用python编写一个程序,但是我需要将羽毛图标更改为我当前工作的公司的图标。

我已经找到了这篇文章:Python EasyGUI 更改任务栏图标

问题是,我也使用 diropenbox、ynbox 和 msgbox,当我查看“衍生_boxes.py”和“diropen_box.py”文件时,这些似乎与选择框和按钮框的工作方式不同。 有人对如何编辑文件有一些建议,以便我也可以更改此处的图标吗? 非常感谢!!

python icons easygui
1个回答
0
投票

其余的实际上非常简单,您只需在“fillable_box.py”文件中的正确位置添加一行即可:

...
def __fillablebox(msg, title="", default="", mask=None, image=None, root=None):
    """
    Show a box in which a user can enter some text.
    You may optionally specify some default text, which will appear in the
    enterbox when it is displayed.
    Returns the text that the user entered, or None if they cancel the 
    operation.
    """

    global boxRoot, __enterboxText, __enterboxDefaultText
    global cancelButton, entryWidget, okButton

    if title is None:
        title = ""
    if default is None:
        default = ""
    __enterboxDefaultText = default
    __enterboxText = __enterboxDefaultText

    if root:
        root.withdraw()
        boxRoot.withdraw()
    else:
        boxRoot = tk.Tk()
        boxRoot.iconbitmap("put\the\directory\of\the\.ico\file\here") #add this line
        boxRoot.withdraw()

...
© www.soinside.com 2019 - 2024. All rights reserved.