我要回调,在下面的代码PyGTK如何将不同的回调绑定到标签上的每个可点击的文本?
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
def hello(*args):
print "hello, this is most used text editor for pyton"
def wellcome(*args):
print "wellcome to the our program please update to premium version"
w = gtk.Window(title = "example", type = gtk.WindowType.TOPLEVEL)
w.resize(300, 200)
mylabel = gtk.Label()
mylabel.set_markup("""please read """
"""<span underline = "single" command = "hello">hello</span> or """
"""<span underline = "single" command = "wellcome">wellcome</span>""")
w.add(mylabel)
w.show_all()
gtk.main()
我知道,攀高跨度属性不包含的命令选项,好连接到标签
例如文本。有没有另一种方式来做到这一点?
您需要使用两个'Gtk.Button's并连接到他们的'clicked'信号。 – elya5
@ elya5,你能举个例子吗? –