'Reading text from user in Python Arcade library
Is there a way in Python Arcade library to read text from the user (with textbox rectangle, or popup, etc.)? Without the need to read each key, and interpereting it (and translate to some other char if the system language isn't English).
If not, is there built-in way to check what is the correct character for the pressed key (depends to the system language and Caps Lock state, etc)?
I found just ways to write texts, but not to read them.
Solution 1:[1]
I don't see such functionality in Arcade.
The only way is to build your own. Simple example:
import arcade
class Game(arcade.Window):
def __init__(self):
super().__init__(400, 300)
self.text = ''
def on_draw(self):
arcade.start_render()
arcade.draw_text(self.text, 200, 150, arcade.color.GREEN, 24, anchor_x='center')
def on_key_press(self, key, key_modifiers):
self.text += chr(key)
Game()
arcade.run()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alderven |

