Shane Geddes
Shane Geddes

Reputation: 41

PyQt4: Stop Window from taking Focus

What I am trying to do is make an on screen keyboard. To do this I need to stop the Program from taking focus away from other windows. Here is the code I have that keeps the window on top.

import sys
from PyQt4 import QtGui, QtCore, Qt
class mymainwindow(QtGui.QMainWindow):
    def __init__(self):
        QtGui.QMainWindow.__init__(self, None, QtCore.Qt.WindowStaysOnTopHint)
app = QtGui.QApplication(sys.argv)
mywindow.show()
app.exec_()

(Note: Example from Keep Window on Top) So what I want to do is add code to stop the window taking focus.

Thanks

Upvotes: 4

Views: 865

Answers (1)

Kamil Klimek
Kamil Klimek

Reputation: 13140

Change focus policy of window and all of its contents QWidget::setFocusPolicy

Upvotes: 2

Related Questions