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. How to add logo
Forum Updated to NodeBB v4.3 + New Features

How to add logo

Scheduled Pinned Locked Moved Unsolved Qt for Python
4 Posts 2 Posters 5.3k 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.
  • priscilla vP Offline
    priscilla vP Offline
    priscilla v
    wrote on last edited by
    #1

    Hi, I'm editing a pc program in PyQT4, how can I add my logo anywhere in the program?

    Volodymyr14V 1 Reply Last reply
    0
    • priscilla vP priscilla v

      Hi, I'm editing a pc program in PyQT4, how can I add my logo anywhere in the program?

      Volodymyr14V Offline
      Volodymyr14V Offline
      Volodymyr14
      wrote on last edited by
      #2

      @priscilla-v You can add the logo anywhere where You want. If You want to add logo to the window title:

      window.setWindowIcon(QtGui.QIcon("Path/To/logo.png"))
      

      for example to the button:

      button.setIcon(QtGui.QIcon("Path/To/logo.png"))
      

      PyQt/PySide

      1 Reply Last reply
      0
      • priscilla vP Offline
        priscilla vP Offline
        priscilla v
        wrote on last edited by
        #3

        @Volodymyr14 said in How to add logo:

        button.setIcon(QtGui.QIcon("Path/To/logo.png"))

        Hello, I try but nothing happens, in what folder should I place the image?

        Volodymyr14V 1 Reply Last reply
        0
        • priscilla vP priscilla v

          @Volodymyr14 said in How to add logo:

          button.setIcon(QtGui.QIcon("Path/To/logo.png"))

          Hello, I try but nothing happens, in what folder should I place the image?

          Volodymyr14V Offline
          Volodymyr14V Offline
          Volodymyr14
          wrote on last edited by
          #4

          @priscilla-v You need to find the folder with PyQt application, then find the file with main application (you_qt_app.py), In this file find the class which realizes the application window and usually in the init function of this class add something like this:

          self.setWindowIcon(QtGui.QIcon("Path/To/logo.png"))
          

          or if

          window = QtGui.QWidget()
          window.setWindowIcon(QtGui.QIcon("Path/To/logo.png"))
          

          with buttons, labels, other elements, they are usually in the init function of the application/widget class

          self.some_button.setIcon(QtGui.QIcon("Path/To/logo.png"))
          

          or

          some_button.setIcon(QtGui.QIcon("Path/To/logo.png"))
          

          the names of the buttons (any elements) can be any.
          Usually, buttons have a declaration:

          self.some_but = QtGui.PushButton()
          

          but it will not necessarily be like this.
          Need to read by the content in the app files.
          The images is recommended to place in the one folder with app. For example, if app path App/app.py can create in the App folder Icons folder and put to Icons folder logo.png file.
          The path will be:

          self.setWindowIcon(QtGui.QIcon("Icons/logo.png"))
          

          You can put here some part of the file with the application if You have a problems with code.

          PyQt/PySide

          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