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_())