donglu5047 2019-04-29 14:52
浏览 49

GoGtk3自定义信号

I need to know how to write a custom signal in GoGtk3. Having a gui thread wherein gtk is working in, I want to update a textview from adjacent goroutine.

label,_:= gtk.LabelNew()

go func(){
   // This is listening to a websocket
   //update label
   for {
       c.ReadJSON(&frame) // c is my gorilla websocket 
       fmt.Printf("I received something %v
", frame)
       // label.SetText("update ...") is not working properly

       }
}()

When using label.SetText method, I noticed that this is not working correctly. I suspect this is not thread safe and I should emit a signal instead. I appreciate if you lead me how.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?