Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use qgraphicsscene

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you "how to use qgraphicsscene", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use qgraphicsscene" this article.

This QGraphicsScene class is used to manipulate a large number of 2D graphic elements in the scene, this class exists as a container QGraphicsItems, it is together with QGraphicsView for visualization of two-dimensional surface graphics items, such as lines, rectangles, text, and even custom objects; it can also effectively determine the location of elements in the scene and control the display area and way of elements. With QGraphicsView you can visualize the whole scene, or zoom out or show only part of the scene.

What is qgraphicsscene?

First of all, let's change the name QGraphicsView,QGraphicsScene:

QGraphicsScene is called a graphical scene.

QGraphicsView is called the graphics window.

You can understand that the QGraphicsScene graphics window is a visual interface, just like the shell of a TV, and the QGraphicsScene graphics scene is the screen of the TV. The content to be played is to be displayed on the screen.

Note: the QGraphicsScene graphics window has its own non-visual appearance, which only manages projects. You need to create a QGraphicsView graphical view to load the widget to visualize the scene.

Qgraphicsscene example

_ _ author__='liaojie'

#! / usr/bin/envpython

# coding:utf-8

FromPyQt5.QtWidgetsimport (QGraphicsView,QGraphicsScene,QApplication)

If__name__=='__main__':

Importsys

# each PyQt program must create an application object, and the sys.argv parameter is a set of parameters on the command line

# Note: application is in the PyQt5.QtWidgets module

# Note: application is in the PyQt4.QtGui module

App=QApplication (sys.argv)

# create a scene

Scene=QGraphicsScene ()

# add text to the scene

Scene.addText ("Hello,world!")

# create a window and load the scene into the window

View=QGraphicsView (

# display application

View.show ()

The above is all the contents of this article "how to use qgraphicsscene". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report