I am attempting to learn how to use PyQt4. For some reason I can not seem to display this logo.
import sys
from PyQt4 import QtGui
def __init__(self):
super(Window, self).__init__() #returns parent object (q main window object)
self.setGeometry(50, 50, 500, 300)
self.setWindowTitle("PyQt4 Window")
y = '/home/rob/PycharmProjects/untitled/Logo.jpg'
self.
setWindowIcon(QtGui.
QIcon(y
)) self.show()
GUI = Window()
sys.exit(app.exec_())
import sys
from PyQt4 import QtGui
class Window(QtGui.QMainWindow):
def __init__(self):
super(Window, self).__init__() #returns parent object (q main window object)
self.setGeometry(50, 50, 500, 300)
self.setWindowTitle("PyQt4 Window")
y = '/home/rob/PycharmProjects/untitled/Logo.jpg'
self.setWindowIcon(QtGui.QIcon(y))
self.show()
app = QtGui.QApplication(sys.argv)
GUI = Window()
sys.exit(app.exec_())
To copy to clipboard, switch view to plain text mode
What am I doing wrong?
EDIT: using Ubuntu 16.04 and py3
Added after 31 minutes:
Is there a way to mark these posts as solved? Turns out it is working. I was expecting the image to show up on the actual pop-up window; however, it appears on the icon in the task bar not the window and I just never noticed until a moment ago.
Bookmarks