-
Book Overview & Buying
-
Table Of Contents
Qt5 Python GUI Programming Cookbook
By :
In this recipe, you will learn to display a 2D graphical image. We assume that you have a graphical image by the name scene.jpg on your machine, and you will learn how it is displayed on the form. The focus of this recipe is to understand how the Graphics View widget is used to display an image.
The procedure for displaying graphics is very simple. You first need to create an object of QGraphicsScene, which in turn makes use of the QGraphicsView class to show its contents. Graphical items, including images, are then added to the QGraphicsScene class by invoking the addItem method of the QGraphicsScene class. Here are the steps to display a 2D graphical image on the screen:
Dialog without Buttons template.Graphics View widget onto it.demoGraphicsView.ui. The form will appear as shown in the following screenshot:
The pyuic5command utility converts the.ui(XML...