The Okey module contains some convenient functions to add handlers for key press events in LablGtk2 applications.

The documentation generated by OCamldoc can be browsed here.

The following example creates a window with a label in it displaying the handled key press events. Some handlers show a message box and one handler quits.
(* Compile with
  ocamlfind ocamlc -o okey_example.x -package lablgtk2-extras -linkpkg <this_file> *)

let _ = GMain.Main.init ()
let w = GWindow.window
    ~title: "Okey example" ~width: 300 ~height: 300 ()

let message s () =
  GToolbox.message_box "Okey example message" s

let callbacks =
    GdkKeysyms._k, [`MOD1], "Alt-k", "Hello", message "Hello" ;
    GdkKeysyms._w, [], "w", "World", message "World" ;
    GdkKeysyms._q, [`CONTROL], "Ctrl-q", "Quit", GMain.Main.quit ;

let txt = "Available shortcuts:\n"^
  (String.concat "\n"
     (List.map (fun (_,_,s,l,_) -> Printf.sprintf "%s: %s" s l) callbacks)

let wl = GMisc.label ~text: txt ~packing: w#add ()

(* Here we add the handlers for some key press events *)
let _ = List.iter
    (fun (k,mods,_,_,f) -> Okey.add w ~mods k f)

let _ = w#show ()
let _ = GMain.Main.main ()