#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
from PyQt5.QtWidgets import (QWidget, QPushButton,
QHBoxLayout, QVBoxLayout, QApplication, QListWidget, QLineEdit, QListWidgetItem,
QFileDialog)
class Example(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
Bt_1 = QPushButton("New", self)
Bt_1.move(10,10)
Bt_2 = QPushButton("Mod", self)
Bt_2.move(10,35)
List = QListWidget(self)
List.move(90,10)
Line = QLineEdit(self)
Line. move(10, 60)
Line.resize(70, 20)
Line_2 = QLineEdit(self)
Line_2.move(10, 85)
Line_2.resize(70, 20)
self.setGeometry(300, 300, 400, 400)
self.show()
def on_addClicked():
text = self.Line + " " + Line_2.text()
if len(text):
lvi = QListWidgetItem(self.List)[0]
lvi.setText(0, text)
def delete():
Bt_1.clicked.connect(on_addClicked)
Bt_2.clicked.connect(delete)
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())