Python 2.7:如何使用PySimpleGUI27从我的GUI应用中删除Tkinter徽标?

时间:2019-04-30 06:19:48

标签: python user-interface tkinter icons pysimplegui

我使用了围绕Tkinter的PySimpleGUI27框架在python中创建gui。我的GUI工作正常,但它在左上角带有tkinter图标,如下图所示:

enter image description here

有什么方法可以在PySimpleGUI27框架中删除此图标?我似乎在PySimpleGUI27食谱中找不到答案。

更新:

尝试此操作后出现错误

尝试了button, values_dict = window.Read()后,在window = sg.Window('A2L Parser', default_element_size=(40, 1), icon='C:\Users\XXX\Desktop\index.png').Layout(layout)行中出现了以下错误

Exception has occurred: TclError
couldn't recognize image data
  File "C:\Python27\Lib\lib-tk\Tkinter.py", line 3331, in __init__
    self.tk.call(('image', 'create', imgtype, name,) + options)
  File "C:\Python27\Lib\lib-tk\Tkinter.py", line 3377, in __init__
    Image.__init__(self, 'photo', name, cnf, master, **kw)
  File "C:\Python27\Lib\site-packages\PySimpleGUI27\PySimpleGUI27.py", line 3694, in SetIcon
    wicon = tkinter.PhotoImage(data=icon)
  File "C:\Python27\Lib\site-packages\PySimpleGUI27\PySimpleGUI27.py", line 6105, in StartupTK
    my_flex_form.SetIcon(my_flex_form.WindowIcon)
  File "C:\Python27\Lib\site-packages\PySimpleGUI27\PySimpleGUI27.py", line 3685, in Show
    StartupTK(self)
  File "C:\Python27\Lib\site-packages\PySimpleGUI27\PySimpleGUI27.py", line 3760, in Read
    self.Show()
  File "C:\Users\anubhav.jhalani\Documents\A2L Parser\A2L parser_29_04\A2L parser\run.py", line 26, in <module>
    button, values_dict = window.Read()
  File "C:\Python27\Lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Lib\runpy.py", line 82, in _run_module_code
    mod_name, mod_fname, mod_loader, pkg_name)
  File "C:\Python27\Lib\runpy.py", line 252, in run_path
    return _run_module_code(code, init_globals, run_name, path_name)

0 个答案:

没有答案