I would like to use the `qubesadmin.events.EventsDispatcher` in my Gtk Application. What is the best way to start listening for the dispatcher events without causing any Gtk thread issues.
Currently, I use the `qubesadmin.events.EventsDispatcher` is follow:
**main.py**
```python
import asyncio
import qubesadmin
import qubesadmin.events
import gbulb
gbulb.install()
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
def start_qubes_dispatcher(qubes, dispatcher):
loop = asyncio.get_event_loop()
tasks = [
asyncio.ensure_future(
dispatcher.listen_for_events()
)
]
loop.run_until_complete(
asyncio.wait(
tasks, return_when=asyncio.FIRST_EXCEPTION
)
)
global label
def update_label(*args, **kwargs):
label.set_text(f'The current event is {args[1]}')
label.show_all()
qubes = qubesadmin.Qubes()
dispatcher = qubesadmin.events.EventsDispatcher(qubes)
dispatcher.add_handler('*', update_label)
window = Gtk.Window()
label = Gtk.Label()
window.add(label)
window.show_all()
start_qubes_dispatcher(qubes, dispatcher)
Gtk.main()
```
Is this the best way and thread safest to use the `qubesadmin.events.EventsDispatcher` with Gtk applications?