Unsolved Why does my program take long to run after adding background-image property?
-
am writing a Python program using PyQt5 GUI framework. The program has over 4800 lines of code, it comprises of over 15 different classes and each of the classes is managed by QLayouts and Qgroupboxes.
My program runs fine as expected under few seconds.
But since I started adding background-image to the group boxes stylesheets, the program has been taking almost 4minutes to start when run.
Before I added the background-image property to the stylesheet of the group boxes, my program runs less than a minute.
The format I used in setting the background image is
gbox.setStyleSheet("background-image: url(bkg8.jpg)")
where gbox is the name of one of the group boxes and bkg8 is the name of one of the images I'm using for the background.
Note: When the program finally starts, everything goes fine as expected. My only challenge is that it takes too long to run/start
When I remove the background-image property from the stylesheet of the group boxes, the program runs fine.
There are over 30 group boxes in my program.
Do you have any idea on why it's slow or what I could do to make the program run fast?
Even after pyinstallation and creating an app out of it, the app takes about 4minutes to start and I'm not comfortable with this.
-
Hi,
Which size is that image ?
-
@SGaist less than 11kb, 946byte.
-
@CEO what is the image size in pixels?
-
The Pixels value 58.0kb -2560 * 1440px,
11.16kb -736 * 414px,
0.95kb -365 * 261px,
11.96kb - 626 * 313px -
@eyllanesc I've resolved it. The one with size 58kb was what was causing the slow startup. I've replaced it with an image of smaller size: 1.2kb and my program starts within few seconds after run
-
@CEO You say a 1.2k image takes a few seconds and a 58k one takes 4 minutes, right?