Using Qt Designerįirst, create a MainWindow object in Qt Designer and add a "Label" to it. Below we'll look at how to use QLabel to display a widget in your applications. ![]() The primary use of QLabel is of course to add labels to a UI, but it also has the ability to display an image - or pixmap - instead, covering the entire area of the widget. The widget you use to display an image is QLabel. Since you're wanting to insert an image you might be expecting to use a widget named QImage or similar, but that would make a bit too much sense! QImage is actually Qt's image object type, which is used to store the actual image data for use within your application. In this short tutorial, we will look at how you can insert an external image into your PyQt5/Pyside2 application layout, using both code and Qt Designer. Unfortunately, because of how this is done in Qt, it can be a little bit tricky to work out at first. ![]() Adding images to your application is a common requirement, whether you're building an image/photo viewer, or just want to add some decoration to your GUI.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |