This commit is contained in:
Taiko2k
2022-01-25 16:15:56 +13:00
parent 66e2bc1ce4
commit cafed15f3a

View File

@@ -473,6 +473,14 @@ See also: [EventControllerMotion](https://docs.gtk.org/gtk4/class.EventControlle
See also: [EventControllerKey](https://docs.gtk.org/gtk4/class.EventControllerKey.html)
```python
evk = Gtk.EventControllerKey.new()
evk.connect("key-pressed", self.key_press)
self.add_controller(evk) # add to window
def key_press(self, event, keyval, keycode, state):
if keyval == Gdk.KEY_q and state & Gdk.ModifierType.CONTROL_MASK:
self.close()
```
## Setting the cursor