mirror of
https://github.com/Taiko2k/GTK4PythonTutorial.git
synced 2026-11-10 06:40:09 +01:00
update
This commit is contained in:
1 parent
66e2bc1ce4
commit
cafed15f3a
1 file changed
+8
@@ -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)
|
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
|
## Setting the cursor
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user