Skip to content

Commit 2a7a177

Browse files
authored
remove workaround for tab usage (#2509)
1 parent dbb1100 commit 2a7a177

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

arcade/examples/gui/exp_hidden_password.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def __init__(self):
7272
# add warning label
7373
self.warning_label = grid.add(
7474
UILabel(
75-
text="Use [enter] to switch fields, then enter to login",
75+
text="Use 'TAB' to switch fields, then enter to login",
7676
width=150,
7777
font_size=10,
7878
font_name="Kenney Future",
@@ -93,13 +93,21 @@ def __init__(self):
9393
def on_key_press(self, symbol: int, modifiers: int) -> bool | None:
9494
# if username field active, switch fields with enter
9595
if self.username_input.active:
96-
if symbol == arcade.key.ENTER:
96+
if symbol == arcade.key.TAB:
9797
self.username_input.deactivate()
9898
self.password_input.activate()
9999
return True
100+
elif symbol == arcade.key.ENTER:
101+
self.username_input.deactivate()
102+
self.on_login(None)
103+
return True
100104
# if password field active, login with enter
101105
elif self.password_input.active:
102-
if symbol == arcade.key.ENTER:
106+
if symbol == arcade.key.TAB:
107+
self.username_input.activate()
108+
self.password_input.deactivate()
109+
return True
110+
elif symbol == arcade.key.ENTER:
103111
self.password_input.deactivate()
104112
self.on_login(None)
105113
return True

0 commit comments

Comments
 (0)