Window icon is not visible.
-
Hi,
I trying show icon in window but is not visible in window.
bellow attaching some sample what i triedfrom PySide2.QtWidgets import QApplication, QWidget import sys from PySide2.QtGui import QIcon class Window(QWidget): def __init__(self): super().__init__() self.setWindowTitle("Setting Icon") self.setGeometry(300,300, 500,400) self.setWindowIcon(QIcon("sharp-osa.png")) myApp = QApplication(sys.argv) window = Window() window.show() myApp.exec_() sys.exit(0)is something missing in code.
Python version3.8.2
Is not setting icon in window left corner, setting icon as application icon
-
Hi,
I trying show icon in window but is not visible in window.
bellow attaching some sample what i triedfrom PySide2.QtWidgets import QApplication, QWidget import sys from PySide2.QtGui import QIcon class Window(QWidget): def __init__(self): super().__init__() self.setWindowTitle("Setting Icon") self.setGeometry(300,300, 500,400) self.setWindowIcon(QIcon("sharp-osa.png")) myApp = QApplication(sys.argv) window = Window() window.show() myApp.exec_() sys.exit(0)is something missing in code.
Python version3.8.2
Is not setting icon in window left corner, setting icon as application icon
@yashi95
https://doc.qt.io/qt-5/qicon.html#QIcon-4If fileName contains a relative path (e.g. the filename only) the relevant file must be found relative to the runtime working directory.
One guess: file not found. How do we know where your file is and what the app's working directory is?
Or: do we even know if GNOME sets any window icons "in window left corner", I'm not sure I've seen that anywhere else?
-
@yashi95
https://doc.qt.io/qt-5/qicon.html#QIcon-4If fileName contains a relative path (e.g. the filename only) the relevant file must be found relative to the runtime working directory.
One guess: file not found. How do we know where your file is and what the app's working directory is?
Or: do we even know if GNOME sets any window icons "in window left corner", I'm not sure I've seen that anywhere else?
My file directory in the same folder where my app is running. I am not getting any error like "file not found" icon is setting but in the taskbar is setting like if u see in an image which I share right hand side if you see taskbar one red cross icon
-
My file directory in the same folder where my app is running. I am not getting any error like "file not found" icon is setting but in the taskbar is setting like if u see in an image which I share right hand side if you see taskbar one red cross icon
@yashi95 said in Window icon is not visible.:
I am not getting any error like "file not found" icon
There would be nowhere for an error to come from, if it were the case. I do not know whether GNOME would show any "red cross".
I previously said:
Or: do we even know if GNOME sets any window icons "in window left corner", I'm not sure I've seen that anywhere else?
If you think it should be setting a "window left corner" icon, can you show me any GNOME window which has that? Is it supported?
I only know you can set a GNOME application icon, which shows in the taskbar.
-
Hi,
I think you have to call QApplication::setWindowIcon for that one.
If not working, then take a look here.
-
Hi,
I trying show icon in window but is not visible in window.
bellow attaching some sample what i triedfrom PySide2.QtWidgets import QApplication, QWidget import sys from PySide2.QtGui import QIcon class Window(QWidget): def __init__(self): super().__init__() self.setWindowTitle("Setting Icon") self.setGeometry(300,300, 500,400) self.setWindowIcon(QIcon("sharp-osa.png")) myApp = QApplication(sys.argv) window = Window() window.show() myApp.exec_() sys.exit(0)is something missing in code.
Python version3.8.2
Is not setting icon in window left corner, setting icon as application icon