Skip to content

Instantly share code, notes, and snippets.

@ozcan
Created December 7, 2012 03:10
Show Gist options
  • Save ozcan/4230453 to your computer and use it in GitHub Desktop.
Save ozcan/4230453 to your computer and use it in GitHub Desktop.
keybinder_focus_problem
#!/usr/bin/env python
from gi.repository import Gtk, Keybinder
class Win(Gtk.Window):
def __init__(self):
super(Win, self).__init__()
self.connect('destroy', Gtk.main_quit)
self.resize(200, 200)
self.set_modal(True)
self.paned = Gtk.VPaned()
self.paned.set_property('position', 100)
self.paned.add1(Gtk.Entry())
self.paned.add2(Gtk.Entry())
self.add(self.paned)
self.show_all()
def show_hide(self):
if self.get_visible():
self.hide()
else:
self.show_all()
def main():
app = Win()
Keybinder.init()
Keybinder.bind('F12', lambda x, y: app.show_hide(), None)
Gtk.main()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment