Answer the question
In order to leave comments, you need to log in
How to remove the border around the image placed in the button?
Using the PyQt5 module, I placed an image in the button. But a frame appeared around it, which I would like to remove (the picture will be below). I assume the solution is to set the size of the button to the size of the image using the setGeometry() method, but I didn't want to set the exact button coordinate value that this method requires. Please tell me how to remove the frame?
from PyQt5 import QtWidgets, QtGui, QtCore
import sys
app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QWidget()
button = QtWidgets.QPushButton('Button')
button = QtWidgets.QPushButton()
button.setIcon(QtGui.QIcon('picture1.png'))
button.setIconSize(QtCore.QSize(150, 150))
box1 = QtWidgets.QHBoxLayout()
box1.addWidget(button)
window.setLayout(box1)
window.show()
sys.exit(app.exec_())
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question