I have a mainwindow and its having a window icon and image in the screen. The image and the icon is in the subfolder ("/images/"). the script working well when i execute the py file..
When i try to convert this script to exe i couldn't find image and icon file in the app.
Command used to convert py to exe
pyinstaller --onefile -w main.py
Script code below:
from PyQt5.QtWidgets import QApplication,QMainWindow,QAction, QMessageBox,QLabel,QVBoxLayout, QWidget,QDialog
from PyQt5 import QtGui
from PyQt5.QtGui import QPixmap
import sys
class Mainwindow(QMainWindow):
def __init__(self):
super().__init__()
self.title = 'VASA STUDIO'
self.left = 600
self.top = 200
self.width = 400
self.height = 300
icon_image = 'images\VASA_ICON.png'
self.main_image = 'images\VASA_MAIN.jpg'
self.setWindowTitle(self.title)
self.windowpage()
self.setWindowIcon(QtGui.QIcon(icon_image))
self.centralWidget()
self.show()
def windowpage(self):
menubar = self.menuBar()
menubar.setStyleSheet(('font: 10 14pt "Calibri" bold'))
self.loginmenu = menubar.addMenu('Login')
chgpwdmenu = menubar.addMenu('Change Password')
addstaffmenu = menubar.addMenu('Add Staffs')
custbillmenu = menubar.addMenu('Customer Billing')
prodcostmenu = menubar.addMenu('Product Cost')
expensemenu = menubar.addMenu('Expense')
workstatsmenu= menubar.addMenu('Work Status')
reportsmenu = menubar.addMenu('Reports')
remindermenu = menubar.addMenu('Reminders')
logoutmenu = menubar.addMenu('Log Out')
exitmenu =menubar.addMenu('Exit')
self.menulist = [chgpwdmenu,addstaffmenu,custbillmenu,prodcostmenu,expensemenu,workstatsmenu,reportsmenu,remindermenu,logoutmenu]
self.staffmenu =[custbillmenu,reportsmenu,remindermenu,logoutmenu,exitmenu]
for menu in self.menulist:
menu.setDisabled(True)
self.central_widget = QWidget()
self.setCentralWidget(self.central_widget)
vbox = QVBoxLayout(self.central_widget)
self.label = QLabel()
pixmap = QPixmap(self.main_image)
self.label.setPixmap(pixmap)
self.label.setScaledContents(True)
self.label.resize(pixmap.width(),pixmap.height())
vbox.addWidget(self.label)
if __name__ == "__main__":
app = QApplication(sys.argv)
window = Mainwindow()
window.showMaximized()
sys.exit(app.exec_())
Please help on this how to get the images and icons in the app.