PyQt Window Focus

前端 未结 3 1967
孤独总比滥情好
孤独总比滥情好 2021-01-18 00:49

I am trying to give focus to a window if the user clicks on another window.

Right now i have two windows: Window A is behind, and Window B is in front. When Window B

3条回答
  •  情歌与酒
    2021-01-18 01:14

    To get window_b to always stay on top you have to add the windowflag QtCore.Qt.WindowStaysOnTopHint. In your __init__ add the call

    self.setWindowFlags(PyQt4.QtCore.Qt.WindowStaysOnTopHint)
    

    I have to add that this only is a hint to the windowing manager and not guaranteed to succeed.

提交回复
热议问题