[GH-ISSUE #409] Cannot add icon #329

Closed
opened 2026-02-26 12:21:14 +03:00 by kerem · 5 comments
Owner

Originally created by @akcoderr on GitHub (Jul 25, 2023).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/409

Originally assigned to: @akcoderr on GitHub.

Traceback (most recent call last):
File "M.py", line 146, in
File "tkinter_init_.py", line 2136, in wm_iconbitmap
_tkinter.TclError: bitmap "matrix.ico" not defined

How to fix this issue?

Originally created by @akcoderr on GitHub (Jul 25, 2023). Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/409 Originally assigned to: @akcoderr on GitHub. Traceback (most recent call last): File "M.py", line 146, in <module> File "tkinter\__init__.py", line 2136, in wm_iconbitmap _tkinter.TclError: bitmap "matrix.ico" not defined How to fix this issue?
kerem 2026-02-26 12:21:14 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@github-actions[bot] commented on GitHub (Jul 25, 2023):

👋 Hi, just a reminder that if you haven't read the help post yet, give it a read to see if your issue is covered in it and make sure to follow the debugging section.

Also please note, as stated in the README, if your issue is only associated with your application and not auto-py-to-exe itself, please do not create an issue in this repository - instead, comment on the help post, video or create a new discussion.

<!-- gh-comment-id:1649914062 --> @github-actions[bot] commented on GitHub (Jul 25, 2023): 👋 Hi, just a reminder that if you haven't read [the help post](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/) yet, give it a read to see if your issue is covered in it and make sure to follow [the debugging section](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/#debugging). Also please note, as stated in the README, if your issue is only associated with your application and not auto-py-to-exe itself, please do not create an issue in this repository - instead, comment on the help [post](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/), [video](https://youtu.be/OZSZHmWSOeM) or create a [new discussion](https://github.com/brentvollebregt/auto-py-to-exe/discussions).
Author
Owner

@brentvollebregt commented on GitHub (Jul 25, 2023):

Could you provide the full traceback? That doesn't look like something from auto-py-to-exe

<!-- gh-comment-id:1649916110 --> @brentvollebregt commented on GitHub (Jul 25, 2023): Could you provide the full traceback? That doesn't look like something from auto-py-to-exe
Author
Owner

@akcoderr commented on GitHub (Jul 25, 2023):

Screenshot (1104)

This is actual issue

M.py is that python file which i want to convert into exe
matrix.ico is that icon i want to add in my exe

please resolve this issue.

<!-- gh-comment-id:1650094601 --> @akcoderr commented on GitHub (Jul 25, 2023): ![Screenshot (1104)](https://github.com/brentvollebregt/auto-py-to-exe/assets/140523678/641e7a3c-ba5b-4c06-91db-3b2a90a43bd0) This is actual issue M.py is that python file which i want to convert into exe matrix.ico is that icon i want to add in my exe please resolve this issue.
Author
Owner

@brentvollebregt commented on GitHub (Jul 26, 2023):

Did you read the help post? Providing the stack trace from the result of following the debugging steps might offer more context.

Also can you please fill out the issue template you cleared - this will give me more info to help resolve your issue.

<!-- gh-comment-id:1651011451 --> @brentvollebregt commented on GitHub (Jul 26, 2023): Did you read the help post? Providing the stack trace from the result of following the debugging steps might offer more context. Also can you please fill out the issue template you cleared - this will give me more info to help resolve your issue.
Author
Owner

@akcoderr commented on GitHub (Jul 26, 2023):

Screenshot (1104)

Sir, thank you for asking and I am glad happy to tell you that the problem is fixed mentioned above.

I tell you the issue happened - The .ico file is not defined means the relative path of the .ico file is mentioned in the .py file.
We need to mention the absolute path of the .ico file in the .py file.

To fix the above issue, follow the steps :

  1. Open the .py file
  2. Make sure that the .py file and .ico file are in the same folder.
  3. Add a variable with raw string and in that string mention the exact path of the .ico file along with the name of the .ico file along with the extension.

ex - icon_path = r"C:\User\lenevo\Desktop\Project\smile.ico"

  1. Now, go to the iconbitmap() and in the function use bitmap method to set the absolute path of the .ico file.

ex - root.iconbitmap(bitmap=icon_path)

  1. Save the .py file.

That's all!

Use auto py to exe as usual and make sure use the icon option to add icon in the .py file and convert it.

It will definitely help.
Thank you.

<!-- gh-comment-id:1651410752 --> @akcoderr commented on GitHub (Jul 26, 2023): ![Screenshot (1104)](https://github.com/brentvollebregt/auto-py-to-exe/assets/140523678/3381b9da-c651-4442-98c1-86ee57ad426e) Sir, thank you for asking and I am glad happy to tell you that the problem is fixed mentioned above. I tell you the issue happened - The .ico file is not defined means the relative path of the .ico file is mentioned in the .py file. We need to mention the absolute path of the .ico file in the .py file. To fix the above issue, follow the steps : 1. Open the .py file 2. Make sure that the .py file and .ico file are in the same folder. 3. Add a variable with raw string and in that string mention the exact path of the .ico file along with the name of the .ico file along with the extension. ex - icon_path = r"C:\User\lenevo\Desktop\Project\smile.ico" 4. Now, go to the iconbitmap() and in the function use bitmap method to set the absolute path of the .ico file. ex - root.iconbitmap(bitmap=icon_path) 5. Save the .py file. That's all! Use auto py to exe as usual and make sure use the icon option to add icon in the .py file and convert it. It will definitely help. Thank you.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/auto-py-to-exe#329
No description provided.