I have a list of strings that i want to print the next element of the it by pressing a pushbutton each time.
Also, how can i print the previous item of the list by pressing another pushbutton?
Here is a sample code:
from PyQt5 import QtCore, QtWidgets
import sys
class Main(QtWidgets.QMainWindow):
def __init__(self):
self.pushbutton = QtWidgets.QPushButton(self)
self.pushbutton.move(20,20)
self.list = ["first","second","third"]
self.setGeometry(300,300,250,180)
self.pushbutton.clicked.connect(self.showElements)
self.show()
def showElements(self):
pass
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())