mirror of
https://github.com/Relintai/gdnative_python.git
synced 2024-11-14 10:27:22 +01:00
17 lines
545 B
Python
17 lines
545 B
Python
from godot import exposed, InputEventKey, KEY_UP, KEY_DOWN, LineEdit
|
|
|
|
|
|
@exposed(tool=True)
|
|
class InputBox(LineEdit):
|
|
def _enter_tree(self):
|
|
self.repl_node = self.get_parent().get_parent()
|
|
|
|
def _gui_input(self, event):
|
|
if isinstance(event, InputEventKey) and event.pressed:
|
|
if event.scancode == KEY_UP:
|
|
self.repl_node.up_pressed()
|
|
self.accept_event()
|
|
elif event.scancode == KEY_DOWN:
|
|
self.repl_node.down_pressed()
|
|
self.accept_event()
|