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 set icon on Qlabel in pyside2

How to set icon on Qlabel in pyside2

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 1.2k 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.
  • Y Offline
    Y Offline
    yashi95
    wrote on last edited by
    #1

    Hello
    I try to display an icon on the label please provide some solution ho to show below my code how I trying to display.
    self.lableImg = self.embeddedAppUpdate.findChild(QLabel, "lbl_img")
    self.lableImg.setPixmap(QPixmap("icon/exit.png"))
    self.lableImg.setMask(QPixmap("icon/exit.png").mask())
    self.lableImg.show()

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

      Hi
      There is nothing more to it than setPixmap.
      If nothing shows its most likely due to path.
      you are using icon/exit.png
      try with full path and see.

      and then maybe consider using a QRessouce file to hold the png's
      https://doc.qt.io/qtforpython/overviews/resources.html

      1 Reply Last reply
      3

      • Login

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