Interacting with a gtk.container while gtk.main() is executing?

佐手、 提交于 2019-12-05 11:50:52

This example works for me:

# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4

import gobject
import gtk
from egg import trayicon

label = gtk.Label("Over here")

def callback(widget, ev):
    label.set_text("You found me")

def timeout():
    label.set_text("What are you waiting for?")

tray = trayicon.TrayIcon("TrayIcon")
box = gtk.EventBox()
box.add(label)
tray.add(box)
tray.show_all()

box.connect("button-press-event", callback)

gobject.timeout_add(3000L, timeout)

gtk.main()

Without seeing your code, it's hard to tell what doesn't work.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!