File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -674,6 +674,11 @@ def __str__(self) -> str:
674
674
class TextInput (Event ):
675
675
"""SDL text input event.
676
676
677
+ .. warning::
678
+ These events are not enabled by default since `19.0`.
679
+
680
+ Use :any:`Window.start_text_input` to enable this event.
681
+
677
682
Attributes:
678
683
type (str): Always "TEXTINPUT".
679
684
text (str): A Unicode string with the input.
Original file line number Diff line number Diff line change @@ -167,7 +167,12 @@ def __init__(self, pixels: ArrayLike) -> None:
167
167
168
168
169
169
class Window :
170
- """An SDL2 Window object."""
170
+ """An SDL2 Window object.
171
+
172
+ Created from :any:`tcod.sdl.video.new_window` when working with SDL directly.
173
+
174
+ When using the libtcod :any:`Context` you can access its `Window` via :any:`Context.sdl_window`.
175
+ """
171
176
172
177
def __init__ (self , sdl_window_p : Any ) -> None : # noqa: ANN401
173
178
if ffi .typeof (sdl_window_p ) is not ffi .typeof ("struct SDL_Window*" ):
@@ -444,9 +449,21 @@ def start_text_input(
444
449
multiline: Allow multiple lines of text.
445
450
android_type: Input type for Android, see SDL docs.
446
451
452
+ Example::
453
+
454
+ context: tcod.context.Context # Assuming tcod context is used
455
+
456
+ if context.sdl_window:
457
+ context.sdl_window.start_text_input()
458
+
459
+ ... # Handle Unicode input using TextInput events
460
+
461
+ context.sdl_window.stop_text_input() # Close on-screen keyboard when done
462
+
447
463
.. seealso::
448
464
:any:`stop_text_input`
449
465
:any:`set_text_input_area`
466
+ :any:`TextInput`
450
467
https://wiki.libsdl.org/SDL3/SDL_StartTextInputWithProperties
451
468
452
469
.. versionadded:: 19.1
You can’t perform that action at this time.
0 commit comments