Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

button icon pyqt5

from PyQt4 import QtGui, QtCore

class Window(QtGui.QWidget):
    def __init__(self):
        QtGui.QWidget.__init__(self)
        self.button = QtGui.QPushButton('', self)
        self.button.clicked.connect(self.handleButton)
        self.button.setIcon(QtGui.QIcon('myImage.jpg'))
        self.button.setIconSize(QtCore.QSize(24,24))
        layout = QtGui.QVBoxLayout(self)
        layout.addWidget(self.button)

    def handleButton(self):
        pass


if __name__ == '__main__':

    import sys
    app = QtGui.QApplication(sys.argv)
    window = Window()
    window.show()
    sys.exit(app.exec_())
Comment

PREVIOUS NEXT
Code Example
Python :: how to save inputs python 
Python :: add year to id django 
Python :: matplotlib 3.0.3 wheel file 
Python :: open an exe file using python 
Python :: create dataframe with column names pandas 
Python :: pandas replace values in column based on condition 
Python :: create numpy table with random values in range 
Python :: hotel room allocation tool in python 
Python :: python seaborn violin plot fit data better 
Python :: update tupple in python 
Python :: How do I start a DataFrame index from 1? 
Python :: python format float as currency 
Python :: skewness python 
Python :: python run another python script 
Python :: matplotlib pie label size 
Python :: pyspark correlation between multiple columns 
Python :: binning data dataframe, faire classe statistique dataframe 
Python :: guido van rossum net worth 
Python :: tkinter progresse bar color 
Python :: import csv file in python 
Python :: serializers.py include all fields 
Python :: neat python full form 
Python :: add a dot in a long number in python 
Python :: replacing values in pandas dataframe 
Python :: making hexagon in python turtle 
Python :: django clear db 
Python :: matplotlib Savefig cuts off title 
Python :: how to check for duplicates in a column in python 
Python :: how to launch jupyter notebook from cmd 
Python :: exact distance math 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =