You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been trying to build me own widget that I want it to be mostly like Input widget, but without ability to modify text, so like a text with a cursor that can be moved in it.
To do so, I have a new class that inherits from Input class and I override some of the methods. While doing so, I noticed that some of the methods like _on_focus and _on_paste are not overriden as I expected. While I can verify that my methods are indeed executed, I also see the effects from the ones of the Input class to take place as if they are executed after my methods.
For example, if I change the _on_focus to have the cursor at start rather than end like this:
def _on_focus(self, _: Focus) -> None:
self.cursor_position = 0 # modified line
if self.cursor_blink:
self._blink_timer.resume()
self.app.cursor_position = self.cursor_screen_offset
I still see the cursor appear in the end of the text instead of it appearing over the first character as I would expect.
Is there any explanation of why this happens and how I can prevent it?
Thank you
The text was updated successfully, but these errors were encountered:
I have been trying to build me own widget that I want it to be mostly like Input widget, but without ability to modify text, so like a text with a cursor that can be moved in it.
To do so, I have a new class that inherits from Input class and I override some of the methods. While doing so, I noticed that some of the methods like
_on_focus
and_on_paste
are not overriden as I expected. While I can verify that my methods are indeed executed, I also see the effects from the ones of the Input class to take place as if they are executed after my methods.For example, if I change the
_on_focus
to have the cursor at start rather than end like this:I still see the cursor appear in the end of the text instead of it appearing over the first character as I would expect.
Is there any explanation of why this happens and how I can prevent it?
Thank you
The text was updated successfully, but these errors were encountered: