mirror of
https://github.com/Taiko2k/GTK4PythonTutorial.git
synced 2026-01-05 10:50:10 +01:00
update
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user