Using Tkinter command “iconbitmap” to set window icon

前端 未结 3 1676
鱼传尺愫
鱼传尺愫 2020-12-21 16:25

I have a program with Tkinter window and I want to set an icon for the window. I coded this:okno.iconbitmap(os.path.dirname(os.path.abspath(__file__))+\"/icon.png\")

3条回答
  •  不思量自难忘°
    2020-12-21 16:43

    Assuming this error is thrown in Windows OS, problem is that iconbitmap does not seem to support png filetype in Windows. Use .ico filetype instead. This webtool works superb for me - https://iconverticons.com/online/. For Linux OS, use xbm filetype.

    PS- Please provide relevant details when asking questions next time. For example: name and version of OS where you got this error.

提交回复
热议问题