Python 3 tkinter iconbitmap error in ubuntu

前端 未结 7 1973
既然无缘
既然无缘 2021-01-02 02:12

Well I have this:

import tkinter
gui = tkinter.Tk()
gui.iconbitmap(default=\'/home/me/PycharmProjects/program/icon.ico\')
gui.mainloop()`

B

7条回答
  •  走了就别回头了
    2021-01-02 03:09

    Still in 2018 a high Rank google question. what works for me in python3 is to use ico in Windows and gif in Linux :

    if ( sys.platform.startswith('win')): 
        gui.iconbitmap('logo_Wicon.ico')
    else:
        logo = PhotoImage(file='logo.gif')
        gui.call('wm', 'iconphoto', gui._w, logo)
    

提交回复
热议问题