Setting Icons with the QIcon Class
Learn about setting icons with PyQt in order to add images to our applications.
We'll cover the following
Icons are discrete visual representations of user actions in GUI programs. They are frequently used to make it easier for users to traverse applications and find basic activities more quickly. For instance, the toolbar at the top of the GUI in a word processing program like Microsoft Word comprises a sizable number of icons, each having an icon and text description.
Changing icons is helpful for both toolbar activities and setting the application icon in the GUI window's title bar. The icon denotes four possible states for an action: "Normal", "Disabled", "Active", and "Selected". When configuring the icons on other widgets, QIcon
can also be used.
Note: Users of macOS are unable to modify the programme window due to system restrictions. However, you should still look at this programme because it also demonstrates how to configure icons for other PyQt widgets.
Creating the GUI
Firstly, we start by importing the required modules.
Get hands-on with 1400+ tech skills courses.