How to bring a program to the front using python

I would like to force my python application to the front if a condition occurs. I am using Kubuntu and QT3.1

I tried setActiveWindow () but it only blinks the taskbar in KDE.

I think Windows has bringwindowtofront () function for VB.

Is there something similar for KDE?

+1


source to share


3 answers


Check if KWin is configured to prevent focus theft.



There can't be anything wrong with your code - but we Linux don't like apps that listen to us when we're running, so focus stealing is confusing and difficult under some window managers.

+4


source


Have you tried using these 3 (in that order) in your window and not just setActiveWindow

?



show()
raise() # this might be raiseW() in Python
setActiveWindow()

      

+1


source


It works!

show()
raiseW()
setActiveWindow() #in that sequence

      

plus a change in the KWin configuration to prevent focus prevention.

Thanks for the help.

+1


source







All Articles