当我按下一个键时,如何在 Genie 中停止这个小部件?
// 编译 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(tecla)
def tecla(key : Gdk.EventKey):bool
//spinner.active = false ???
//spinner.stop () ???
返回真
编辑:感谢提供解决方案的 Al Thomas(这是范围问题):
// 编译 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(tecla)
def tecla(key : Gdk.EventKey):bool
spinner.active = false
返回真