python - How to draw a notification on the screen that doesn't take focus and always stays on top (Windows) -


I'm trying to find a way to draw anything on the screen which is running and the top of something (Even full screen applications), but will not steal the focus, or act as a normal application or window. It should be completely visible and not interfere in any other way.

Python is better.

What I'm targeting is to be able to display a notification on my Python script, maybe some text (transparent background), and for whatever you are doing on time Have to show in front.

I have tried wxpython, but either the window is stealing the focus or I use the trick to not steal the focus and it does not appear in front of my full screen app. It seems that wxpython is not actually created for what I want to do, because it is not considered a GUI, it is only considered a notification that appears temporarily and no user takes input.

In general, you can not write an application that is guaranteed to be at the top of other applications. Who want to stay above other applications.

  • Since there is a full-screen application window that is at the top, there is no way for the OS to know that your maximum window is up Other top windows

    Ideally, you should find a way to collaborate with other applications.

    However Here are some tips that you can do, which should work for some situations:

    • You probably have to use the Win32 API directly Have to do.
    • Do not activate your window using SetActive, just use SetWindowPos with SWP_NOACTIVATE and HWND_TOP < Li> Try setting your window to disable, then it can not steal the focus, which is half the problem.
    • You may have to set SystemParametersInfo to a small value in SPI_SETFOREGROUNDLOCKTIMEOUT .
    • You may have to try again and again for the foreground until you receive it.

      Please note that if other windows are doing the same thing, these tricks will not help.

      Useful documents here:

      • SetWindowPos:
      • Set Window Width:
      • SystemParametersInfo: < / Div>

  • Comments