Get text from qtextedit and assign it to a variable

Solution 1:

QTextEdit does not have any text() method, if you want to get the text you must use toPlainText(), if you want to clean the text it is better to use clear() since it makes it more readable.

def search(self):
    textboxValue = self.textbox.toPlainText()
    for pid in psutil.pids():  # Controlla se il processo è attivo
        listapid = psutil.Process(pid)
        if listapid.name() == textboxValue:
            print('Processo trovato')
    self.textbox.clear()