LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-14-2017, 08:03 AM   #1
iFunction
Member
 
Registered: Nov 2015
Posts: 248

Rep: Reputation: Disabled
Qt4 window icon won't display


Hi,

Just learning PyQt4 to build a GUI, but I can't get the window icon to display, it worked on a raspberry pi, but not on Linux Mint Sarah?
Code:
#!/usr/bin/python3

# input.py
# Module for getting userdata via a GUI using PyQt4

import sys
from PyQt4 import QtGui

class Window(QtGui.QMainWindow):

    def __init__(self):
        super(Window, self).__init__()
        self.setGeometry(50, 50, 500, 300)
        self.setWindowTitle("GUI testing")
        self.setWindowIcon(QtGui.QIcon('./tick.png'))
        self.show()



app = QtGui.QApplication(sys.argv)
GUI = Window()
sys.exit(app.exec())
So this is in a folder of it's own, and the png file is in the same folder. I have been told about absolute paths, and I have tried that also but still it does not show up, any ideas please?

Regards
iFunc
 
Old 01-14-2017, 07:29 PM   #2
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Works fine here (Debian Sid/KDE).

Try loading a system icon or test your png file:
Code:
        . . .
        self.setWindowTitle("GUI testing")
        icon =QtGui.QImage('./tick.png')
        print(icon.isNull())        
        self.setWindowIcon(QtGui.QIcon('./tick.png'))
        . . .

Last edited by norobro; 01-14-2017 at 08:14 PM. Reason: corrected code
 
  


Reply

Tags
gui, mint-18, python3


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Desktop display not working after installing qt4, Mandriva 2009 eikeland Linux - Software 3 01-31-2010 10:34 PM
qt4.SlackBuild won't compile qt-4.5.3 on Slack-12.2 based distro silencestone Slackware 8 11-09-2009 07:57 AM
Qt4, - starting one main window from aqnother sorvad Programming 0 10-15-2009 02:54 AM
hplip won't run, wants qt4 CrashedAgain Linux - Software 2 04-07-2009 06:36 PM
how to display system networkinterface list in qt4.5 rakesh.n Linux - Newbie 1 03-16-2009 07:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration