linux - Qt splash screen not shown in python -


i'm trying add splash screen program, coded in python 2.7 , using pyqt4 libraries. main file is:

#!/usr/bin/env python  pyqt4.qtcore import * pyqt4.qtgui import * logindialog import logindialog mainwindow import mainwindow import time import sys   if __name__ == "__main__":     try:         app = qapplication(sys.argv)          mw = mainwindow()          # create , display splash screen         splash_pix = qpixmap('images/sherlock_splash.png')         splash = qsplashscreen(splash_pix, qt.windowstaysontophint)         splash.setmask(splash_pix.mask())          # adding progress bar         progressbar = qprogressbar(splash)         # adding message         splash.showmessage('discovering nodes...', qt.alignright | qt.alignbottom, qt.darkred)          splash.show()         app.processevents()          in range(0, 100):             progressbar.setvalue(i)             # simulate takes time             time.sleep(0.1)          splash.close()          # show main window         mw.show()         app.exec_()     except exception:         sys.exit(1)     sys.exit(0) 

i've coded using pycharm ide. if run using pycharm run functionality splash screen shown properly, if run in linux command line (./main.py) not show splash screen when start application.

anybody me?

thanks lot!

update & fix

... # create , display splash screen image_path = os.path.dirname(os.path.realpath(__file__)) splash_pix = qpixmap('/'.join([image_path, 'images/sherlock_splash.png'])) splash = qsplashscreen(splash_pix, qt.windowstaysontophint) ... 

thanks!

check project structure , sure if relative path .png file correct

'images/sherlock_splash.png' when running command line.

also add following checking

if splash_pix not none:     ... 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -