4

How can I minimize window in PyQt the same way as when _ is pressed?

I use

self.showMinimized()

It really minimizes window.
But there is no refocus to the previous window. As if focus is still on minimized window.

How can I minimize and refocus to the previous window as if minimize button _ is pressed?

Qiao
  • 16,565
  • 29
  • 90
  • 117
  • That seems interesting, but I tried, it works. (Python 3.2-win32 PyQt 4.7.3) – Kabie May 22 '11 at 11:47
  • 1
    I've found the problem, it is on my side. I opened two pyqt window of the same program, one is minimized, other is closed after pressing button. But minimized window is not restored, it just stayed focused, but minimized. On one window `showMinimized()` works good. – Qiao May 22 '11 at 11:54
  • Should I delete this question or something? – Qiao May 22 '11 at 11:56
  • I solved my problem with `showNormal()` and then `showMinimized()` once again. – Qiao May 22 '11 at 12:10
  • 1
    @Qiao: I'm not sure I understand your solution. Is there an actual problem here or were you just misunderstanding something? If there is an actual problem you should post your solution and an explanation, for the benefit of other users. If nothing is wrong you should delete the question. – Katriel May 22 '11 at 12:28
  • 1
    @Qiao If you've solved your problem, please submit an answer that helps future programmers. Thanks! – phihag May 22 '11 at 13:14

2 Answers2

4

Just Connect it this way

Minimized.clicked.connect(self.showMinimized)
Straight Coding
  • 376
  • 3
  • 7
Cuanms
  • 41
  • 2
2

(Copying Qiao's comment as an answer:)

I solved my problem with showNormal() and then showMinimized() once again.

tzot
  • 92,761
  • 29
  • 141
  • 204