0.0
No commit activity in last 3 years
No release in over 3 years
gtk2keypress
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Introducing the GTK2KeyPress gem

#!/usr/bin/env ruby

# file: keypress_event.rb

require 'gtk2'
require 'gtk2keypress'

window = Gtk::Window.new

window.add(Gtk::Label.new("Press Key!"))

key = Gtk2KeyPress.new window

def key.on_keydown(e)
  puts 'key down ' + e.name
end

def key.on_keyup(e)
  puts 'key up ' + e.name
end

window.set_default_size(100, 100).show_all

Gtk.main

The above example demonstrates using the gtk2keypress gem within a GTK2 application. When a key is pressed down or up the on_keydown or on_keyup event is triggered.

Resources

gtk2 gtk2keypress gem event trigger