キーを押したときに Genie でこのウィジェットを停止するにはどうすればよいですか?
// compila con valac --pkg gtk+-3.0 nombre_archivo.gs Gtk を使用 初期化 Gtk.init (参照引数) var テスト = 新しい TestVentana () test.show_all () Gtk.main () クラス TestVentana: ウィンドウ スピナー: Gtk.Spinner 初期化 タイトル = "Ejemplo Gtk" デフォルトの高さ = 300 デフォルト幅 = 300 ボーダー幅 = 50 window_position = WindowPosition.CENTER destroy.connect(Gtk.main_quit) var spinner = new Gtk.Spinner () spinner.active = true 追加 (スピナー) //key_press_event += tecla // OBSOLETO key_press_event.connect(テクラ) def tecla(キー: Gdk.EventKey):bool //spinner.active = false ??? //spinner.stop () ??? 真を返す
編集:解決策を提供してくれたAl Thomasに感謝します(範囲の問題でした):
// compila con valac --pkg gtk+-3.0 nombre_archivo.gs Gtk を使用 初期化 Gtk.init (参照引数) var テスト = 新しい TestVentana () test.show_all () Gtk.main () クラス TestVentana: ウィンドウ スピナー: Gtk.Spinner 初期化 タイトル = "Ejemplo Gtk" デフォルトの高さ = 300 デフォルト幅 = 300 ボーダー幅 = 50 window_position = WindowPosition.CENTER destroy.connect(Gtk.main_quit) スピナー = 新しい Gtk.Spinner () spinner.active = true 追加 (スピナー) // key_press_event += tecla // OBSOLETO key_press_event.connect(テクラ) def tecla(キー: Gdk.EventKey):bool spinner.active = false 真を返す