How it works...

The clicked() event of pushButtonAdd is connected to the addlist function. Similarly, the clicked() event of the pushButtonEdit, pushButtonDelete, and pushButtonDeleteAll objects are connected to the editlist, delitem, and delallitems functions, respectively. That is, on clicking any push button, the respective function is invoked. The addlist function calls the addItem function on the List Widget item to add the text entered in the Line Edit widget. The editlist function uses the currentRow method on List Widget to find out the list item to be edited.

The getText method of the QInputDialog class is invoked to prompt the user for the new text or edited text. On clicking the OK button in the dialog, the current list item will ...

Get Python GUI Programming - A Complete Reference Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.