D
D
Denis Sokolov2020-12-07 20:49:42
PyQt
Denis Sokolov, 2020-12-07 20:49:42

How to add text to the listView that should turn out Python PyQt5?

From PyQt5 import QtWidgets, uic
import sys
import random

Form, _ = uic.loadUiType('main.ui')

password = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890$#@!'

p = list(password)

class Ui(QtWidgets.QMainWindow, Form):
def __init__(self):
super(Ui, self).__init__()
self.setupUi(self)
self.pushButton.clicked.connect(self.generatePassword)

def generatePassword(self):
self.valuePasswords = self.numberPasswords.value()
self.valueLenght = self.lenghtPassword.value()
for i in range(self.valuePasswords):
for k in range(0, self.valueLenght):
for passwordValue in range(1):
ranNum = random.randrange(0, len(p))
#print(password[ranNum], end="")
print(',', end="\n")
self.listView.additem(ranNum)
print(self.valuePasswords, self.valueLenght)

if __name__ == "__main__":
import sys

app = QtWidgets.QApplication(sys.argv)
w = Ui()
w.show()
sys.exit(app.exec_())

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question