From 2a7a1774ed4cdc279818fe688df4e24fec50d8b1 Mon Sep 17 00:00:00 2001 From: Maic Siemering Date: Thu, 23 Jan 2025 21:21:24 +0100 Subject: [PATCH] remove workaround for tab usage (#2509) --- arcade/examples/gui/exp_hidden_password.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/arcade/examples/gui/exp_hidden_password.py b/arcade/examples/gui/exp_hidden_password.py index c5c47362c..722abb692 100644 --- a/arcade/examples/gui/exp_hidden_password.py +++ b/arcade/examples/gui/exp_hidden_password.py @@ -72,7 +72,7 @@ def __init__(self): # add warning label self.warning_label = grid.add( UILabel( - text="Use [enter] to switch fields, then enter to login", + text="Use 'TAB' to switch fields, then enter to login", width=150, font_size=10, font_name="Kenney Future", @@ -93,13 +93,21 @@ def __init__(self): def on_key_press(self, symbol: int, modifiers: int) -> bool | None: # if username field active, switch fields with enter if self.username_input.active: - if symbol == arcade.key.ENTER: + if symbol == arcade.key.TAB: self.username_input.deactivate() self.password_input.activate() return True + elif symbol == arcade.key.ENTER: + self.username_input.deactivate() + self.on_login(None) + return True # if password field active, login with enter elif self.password_input.active: - if symbol == arcade.key.ENTER: + if symbol == arcade.key.TAB: + self.username_input.activate() + self.password_input.deactivate() + return True + elif symbol == arcade.key.ENTER: self.password_input.deactivate() self.on_login(None) return True