I am trying to delete this button
btn = QtGui.QPushButton("Log in", self)
btn.clicked.connect(self.remove)
When the button is clicked, it should disappear,but this doesn't work
btn.deleteQPushButton()
Or if there's any way to entirely delete every button in the window?
An elegant solution is to use deleteLater()
:
btn = QtGui.QPushButton("Log in", self)
btn.clicked.connect(btn.deleteLater)