Beginning PyQt by Joshua M. Willman

Beginning PyQt by Joshua M. Willman

Author:Joshua M. Willman
Language: eng
Format: epub
ISBN: 9781484258576
Publisher: Apress


The QListWidget Class

The QListWidget class creates a widget with an item-based interface that makes it simpler for adding and removing items. Items can be added either when the widget is created in code or added on later. The QListWidgetItem class is used in conjunction with QListWidget to serve as an item that can be used with the list. In the previous example, list_item creates an item that includes text and an icon to be added to the list using the addItem() method .

Listing 8-4 briefly demonstrates how to add, insert, remove, and clear all items from a QListWidget.# listwidget_ex.py

# Import necessary modules

import sys

from PyQt5.QtWidgets import (QApplication, QWidget, QListWidget, QPushButton, QHBoxLayout, QVBoxLayout, QListWidgetItem, QInputDialog)



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.