Skip to content

Instantly share code, notes, and snippets.

@AstraLuma
Created November 29, 2015 23:38
Show Gist options
  • Select an option

  • Save AstraLuma/ad72abb6b6ecb4a264db to your computer and use it in GitHub Desktop.

Select an option

Save AstraLuma/ad72abb6b6ecb4a264db to your computer and use it in GitHub Desktop.
IBus bug demonstration
#!/usr/bin/python3
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk
class TextTestWindow(Gtk.Window):
def __init__(self):
super().__init__(title="Hello World")
self.box = Gtk.VBox(spacing=6)
self.add(self.box)
self.entry = Gtk.Entry()
self.entry.connect("key-press-event", self.on_key_press)
self.box.add(self.entry)
self.label = Gtk.Label()
self.box.add(self.label)
def on_key_press(self, widget, event):
print("Keypress:", event.keyval)
if event.keyval == Gdk.KEY_Return:
t = self.entry.get_text()
self.label.set_text(t)
return True # This causes IBus to fail
win = TextTestWindow()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment