main_button.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:bokken 作者: thestr4ng3r 项目源码 文件源码
def __init__(self, text, menu):
        GObject.GObject.__init__(self)
        self.menu = menu
        hbox1 = Gtk.HBox()
        hbox2 = Gtk.HBox()
        icon = Gtk.Image()
        icon.set_from_file(datafile_path('bokken-small.svg'))
        hbox1.pack_start(icon, True, True, 3)
        label = Gtk.Label()
        label.set_markup("<b>"+ text + "</b>")
        hbox1.pack_start(label, True, True, 3)
        arrow = Gtk.Arrow(Gtk.ArrowType.DOWN, Gtk.ShadowType.IN)
        hbox1.pack_start(arrow, False, False, 3)
        hbox2.pack_start(hbox1, True, True, 0)

        # MEOW Text settings
        #attrs = Pango.AttrList()
        #attrs.change(Pango.AttrWeight(Pango.Weight.SEMIBOLD, 0, -1))
        #label.set_attributes(attrs)

        self.add(hbox2)
        self.set_relief(Gtk.ReliefStyle.NORMAL)
        self.set_can_focus(True)
        self.set_can_default(False)
        self.connect("toggled", self.on_toggled)

        for sig in "selection-done", "deactivate", "cancel":
            menu.connect(sig, self.on_menu_dismiss)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号