##// END OF EJS Templates
Typos found by codespell
Typos found by codespell

File last commit:

r26875:5f90ef7c
r26875:5f90ef7c
Show More
gui-gtk4.py
37 lines | 716 B | text/x-python | PythonLexer
Elliott Sales de Andrade
Add input hooks for GTK4.
r26726 #!/usr/bin/env python
"""Simple Gtk example to manually test event loop integration.
This is meant to run tests manually in ipython as:
In [1]: %gui gtk4
In [2]: %run gui-gtk4.py
"""
import gi
Matthias Bussonnier
reformat
r26736
gi.require_version("Gtk", "4.0")
Elliott Sales de Andrade
Add input hooks for GTK4.
r26726 from gi.repository import Gtk, GLib # noqa
Dimitri Papadopoulos
Typos found by codespell
r26875 def hello_world(widget, data=None):
Elliott Sales de Andrade
Add input hooks for GTK4.
r26726 print("Hello World")
def close_request_cb(widget, data=None):
global running
running = False
running = True
window = Gtk.Window()
window.connect("close-request", close_request_cb)
button = Gtk.Button(label="Hello World")
button.connect("clicked", hello_world, None)
window.set_child(button)
window.show()
context = GLib.MainContext.default()
while running:
context.iteration(True)