So I created a code that has QLineedit on it and has a Qpushbutton below it. The click.connect pointer includes a subprocess command and it goes like this ( I will only put the click.connect pointer since the QLineedit and Qpushbutton are not that important)
def deluser(self):
del1 = self.deluserline.text()
del2 = subprocess.check_output(['userdel',del1)]
self.deluserline.clear()
#if a user is deleted, then it should display this:
self.del3 = QMessageBox()
self.del3.setText("User deleled !")
self.del3.setWindowTitle('User delete')
self.del3.setIcon(QMessageBox.Information)
self.del3.show()
this actually works. It can delete the user that you will input in the QLineedit but I want to know how to make an if else condition here where if the subprocess actually find a user to delete, it will return the delete success QMessagebox and if it doesnt find a user to delete it will display a 'no user is deleted' prompt.
Aucun commentaire:
Enregistrer un commentaire