Skip to content

Commit

Permalink
remove workaround for tab usage
Browse files Browse the repository at this point in the history
  • Loading branch information
eruvanos committed Jan 23, 2025
1 parent 8cf704b commit 9afb7ee
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions arcade/examples/gui/exp_hidden_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand Down

0 comments on commit 9afb7ee

Please sign in to comment.