S
S
Sherlock72832020-12-04 18:25:01
PyQt
Sherlock7283, 2020-12-04 18:25:01

Python how to pass string to lineEdit (Pyqt5)?

def rand_password(self):
        massive = []
        from random import choice
        from string import digits
        string.ascii_letters # Подключение ASCII символов
        'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
        a = int(self.ui.lineEdit.text())
        count = 0
        while count < a:
            num_or_letter = random.randint(1, 2)
            if num_or_letter < 2:
                massive.append(random.choice(string.ascii_letters))
            else:
                massive.append(random.randint(0, 9))
            count = count + 1
        print(*massive, sep = '')
        self.ui.lineEdit_5.setText(*massive, sep = '')


This code should generate a random password. But I can't figure out how to pass this password, which is created in an array, to the program. The console throws an error on what I have now.

Traceback (most recent call last):
  File "C:\Users\mayer\Desktop\╨рэфюьрщч 4.0\main.py", line 62, in rand_password
    self.ui.lineEdit_5.setText(*massive, sep = '')
TypeError: setText() takes no keyword arguments

How to solve this problem?

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