Open yonis65 opened 3 years ago
Can you try an absolute path to the ico file?
It doesn't work
Actually, you have to call these commands prior to "showing" the viewport. We will document this better later today. Below is a working example (expanded the setup_viewport command):
import dearpygui.dearpygui as dpg
vp = dpg.create_viewport()
dpg.setup_dearpygui(viewport=vp)
dpg.set_viewport_small_icon("C:/dev/DearPyGui/Resources/dpg_icon_small.ico")
dpg.set_viewport_large_icon("C:/dev/DearPyGui/Resources/dpg_icon_large.ico")
dpg.show_viewport(vp)
with dpg.window(label="", width=600, height=500) as ne_id:
pass
dpg.start_dearpygui()
Are those icon targets supposed to work on Linux?
I get parsing errors if the small_icon
and large_icon
args are given on create_viewport
directly (perhaps they are not wired properly?)
Tho after creating the viewport and calling both set_viewport_small_icon
and set_viewport_large_icon
with DearPyGui's icons on Resources
dir while it runs ok no icon image is shown on the docks (Windows only, too much low res, wrong data type?)
GLFW might be able to accept a full fat PNG file no problem for the icon, in fact I remember giving it a big PNG and working ok, I see we do call glfwSetWindowIcon
on this current line but doesn't seem to do much.
Icons flat out don't work on Linux. I tried using ICO, PNG, and SVG. Some of which were ones that come with the OS. Here is the min code. I am running Manjaro Cinnamon, kernel 5.13, with Python 3.9, using the latest stable DPG install.
import dearpygui.dearpygui as dpg
import os
win = dpg.add_window()
dpg.set_primary_window(win, True)
dpg.setup_viewport()
dpg.set_viewport_large_icon("/usr/share/icons/Papirus-Dark/64x64/apps/acestream.svg")
dpg.set_viewport_small_icon("/usr/share/icons/Papirus-Dark/64x64/apps/acestream.svg")
dpg.start_dearpygui()
Will check.
Seems to be working on mine.
Hey, devs!! I just started to learn DPG using the documentation of DearPyGUI. I have landed on the same problem @Jah-On is/ was facing.
DearPyGUI version: 1.5.1 Python version: 3.9.7 (on venv)
OS: Ubuntu 20.04, Kernel Version: 5.13.0-39-generic
By the way, thanks a lot for the clean responsive GUI and clear documentation. <3
Hi @SriniMaiya, we will reverify this!
Uhm ... I might have the solution to this one (on windows)
def fix_icon_for_taskbar(app_model_id:str):
# Define application ICON,
# make sure that dpg.viewport(large_icon=..., small_icon=...) kwargs are both set before this function is ran
if (sys_platform := sys.platform) == "win32":
# WINDOWS NEEDS THIS to make this possible
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(app_model_id)
else:
# TODO fix this! (aka, find out how to do this)
raise NotImplementedError(f"the 'fix_icon_for_taskbar' function does not currently work for the os: {sys_platform}")
(it's just a plug from my own lib) as I only work on windows and don't know what the actual equivalent to any of the other OS's might be.
Btw, the app_model_id
can just be any random string, as long as it isn't used by any other app on the pc, aka your application name should do the job
The thing is, for windows, the large_icon
and small_icon
have to be defined as .ico
files
(couple of edits to make my code clearer)
I have a working link on my git repo: https://github.com/DirectiveAthena/AthenaDPGLib/tree/core/examples/ico Reason for repo link and not a plain code block: You need an ico file to test out, so I placed one with the example in the same folder
python 3.10 DearPyGui 1.6.2
Thank you, successfully tested on Windows 10, Python 3.10.4.
After going over my 1am solution I posted above, I scrolled up to see the following example by Hoffstadt
Actually, you have to call these commands prior to "showing" the viewport. We will document this better later today. Below is a working example (expanded the setup_viewport command):
import dearpygui.dearpygui as dpg vp = dpg.create_viewport() dpg.setup_dearpygui(viewport=vp) dpg.set_viewport_small_icon("C:/dev/DearPyGui/Resources/dpg_icon_small.ico") dpg.set_viewport_large_icon("C:/dev/DearPyGui/Resources/dpg_icon_large.ico") dpg.show_viewport(vp) with dpg.window(label="", width=600, height=500) as ne_id: pass dpg.start_dearpygui()
And indeed, in the second file I created in my examples, it works the way Hoffstadt describes:
https://github.com/DirectiveAthena/AthenaDPGLib/blob/core/examples/ico/ico_old_example_hoffstadt.py
Which means there seems to be something wrong with the dpg.create_viewport(large_icon=..., small_icon=...)
kwargs?
I've tried going over the source code (c++) but I can't seem to find where the "issue" occurs, this is probably because my understanding of c++ is very lacking
It’s not working for me(windows 11) but I don’t get any errors.. even if the file does not exist the code run normally except there is no icon… ): I tried everything mention here comment by comment nothing
I have this code:
` setup_viewport()
but it doesn't set the icon. Am I doing something wrong?