I want to make a game that requires the arrow keys to be pressed. How do I detect if a key has been pressed?

In a lot of UI libraries, an event will be passed from the event loop when a button is pressed. Some libraries will call a function or a method directly instead of implementing an event.

What are you using to create your UI?