Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. How to hide a window in the constructor?
  2.  
  3. I wanna hide a window at once it creates. It works only if I do this with the help of button or something.
  4.  
  5. class Example(QWidget):
  6. def __init__(self, parent=None):
  7. super(Example, self).__init__(parent)
  8. self.hide() # doesn't work
  9. self.btn = QPushButton('Hide', self)
  10. self.btn.clicked.connect(self.click) # works
  11. self.btn.show()
  12.  
  13. def click(self): # works
  14. self.hide()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement