python 3.7.8
kivy 2.0.0
Modern programs are able to make changes in a window even when the focus is not True for the app.
Example: Two windows are set side by side (Chrome and Excel). I click inside the Chrome window and it becomes focus True. When I then take my cursor into the Excel window I can click into a cell directly or scroll up and down. This action in Excel does not require me to first click in the Excel window to make it focus True.
I have not been able to replicate this with python-kivy.
Window.on_cursor_enter(do_action())
does not fire when the cursor enters the window.
def on_start(self):
Window.bind(mouse_pos=self.my_callback)
def my_callback(self, instance, value):
Window.focus = True
Throws:
File "kivy\properties.pyx", line 498, in kivy.properties.Property.__set__
File "kivy\properties.pyx", line 1527, in kivy.properties.AliasProperty.set
File "kivy\properties.pyx", line 1485, in kivy.properties.AliasProperty.__read_only
AttributeError: "WindowSDL.focus" property is readonly
UPDATE:
Window.on_cursor_enter(do_action())
is saddled with a pass
in the kivy source. That clears up why it doesn't work.
I think the true correction is going to come from a call to ctypes.windll.user32
...setFocus...something like that
but I am a Python hobbyist, and my understanding of this is limited.