Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

619
Views
¿Cómo configurar un icono de ventana con PyQt5?
from PyQt5 import QtWidgets, QtGui from PyQt5.QtWidgets import * from PyQt5.QtCore import * class Application(QMainWindow): def __init__(self): super(Application, self).__init__() self.setWindowIcon(QtGui.QIcon('icon.png'))

Estoy tratando de configurar un ícono de ventana (arriba a la izquierda de la ventana) pero el ícono normal desapareció en su lugar.

Probé con muchas resoluciones de íconos (8x8, 16x16, 32x32, 64x64) y extensiones (.png y .ico).

¿Qué estoy haciendo mal?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

El comando, como lo sugiere el autor de la pregunta, funciona para mí:

 self.setWindowIcon(QtGui.QIcon('icon.png'))

Puse 256x256 png y todo estuvo bien. Tengo Win 7 pro de 64 bits, Python 3.5.2 de 32 bits.

over 4 years ago · Santiago Trujillo Report

0

La respuesta la ha dado el autor de la pregunta (icono invisible). Quería agregar que es posible que la secuencia de comandos no se ejecute en el directorio de secuencias de comandos. En cualquier caso, para estar seguro, es posible que desee asegurarse de que el ícono se cargue en relación con el directorio en el que reside el script:

 import os # [...] scriptDir = os.path.dirname(os.path.realpath(__file__)) self.setWindowIcon(QtGui.QIcon(scriptDir + os.path.sep + 'logo.png'))
over 4 years ago · Santiago Trujillo Report

0

Estoy usando PyQT5. Y el código debe ser como...

 icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("programmer.png"), QtGui.QIcon.Selected, QtGui.QIcon.On) MainWindow.setWindowIcon(icon)
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!