def add_button(self, id, label, result, *result_args):
"""Adds a button and shows the bar.
Keyword arguments:
id -- A unique identifier for the button
label -- A string for the button label
result -- A function to be called on button click
result_args -- Any arguments for the result function
"""
overwrite = self.get_button(id)
if overwrite:
self._btns.remove(overwrite)
btn = Gtk.Button(label)
btn.connect("clicked", self._callback(result, result_args))
btn.id = id
btn.show()
self._btns.pack_start(btn, False, True, 0)
if not self._visible:
# always animate with buttons
self._show(animate=True)
评论列表
文章目录