Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Why does my program take long to run after adding background-image property?
Forum Updated to NodeBB v4.3 + New Features

Why does my program take long to run after adding background-image property?

Scheduled Pinned Locked Moved Unsolved Qt for Python
7 Posts 4 Posters 748 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CEO.
    wrote on last edited by CEO.
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Which size is that image ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      C 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        Which size is that image ?

        C Offline
        C Offline
        CEO.
        wrote on last edited by
        #3

        @SGaist less than 11kb, 946byte.

        eyllanescE 1 Reply Last reply
        0
        • C CEO.

          @SGaist less than 11kb, 946byte.

          eyllanescE Offline
          eyllanescE Offline
          eyllanesc
          wrote on last edited by
          #4

          @CEO what is the image size in pixels?

          If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

          C 2 Replies Last reply
          0
          • eyllanescE eyllanesc

            @CEO what is the image size in pixels?

            C Offline
            C Offline
            CEO.
            wrote on last edited by CEO.
            #5

            @eyllanesc

            The Pixels value 58.0kb -2560 * 1440px,
            11.16kb -736 * 414px,
            0.95kb -365 * 261px,
            11.96kb - 626 * 313px

            1 Reply Last reply
            0
            • eyllanescE eyllanesc

              @CEO what is the image size in pixels?

              C Offline
              C Offline
              CEO.
              wrote on last edited by
              #6

              @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

              JonBJ 1 Reply Last reply
              0
              • C CEO.

                @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

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #7

                @CEO You say a 1.2k image takes a few seconds and a 58k one takes 4 minutes, right?

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved