本文整理汇总了Python中gtk.Button.connect_object方法的典型用法代码示例。如果您正苦于以下问题:Python Button.connect_object方法的具体用法?Python Button.connect_object怎么用?Python Button.connect_object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk.Button
的用法示例。
在下文中一共展示了Button.connect_object方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gtk import Button [as 别名]
# 或者: from gtk.Button import connect_object [as 别名]
def __init__(self, title=TITLE, level=WINDOW_TOPLEVEL, on_exit=None):
self.title = title
self.grabbing = False
self.events = []
self.rgb = WHITE_RGB
self.on_exit = on_exit
self.window = Window(level)
self.window.set_title(title)
self.window.set_resizable(True)
self.window.add_events(POINTER_MOTION_MASK)
self.window.set_default_size(350, 150)
self.colors = []
grab_btn = Button('Grab')
grab_btn.connect_object('clicked', self.toggle_grab, self.window)
self.grab_btn = grab_btn
exit_btn = Button('Exit')
exit_btn.connect_object('clicked', self.destroy, self.window)
drawing = DrawingArea()
drawing.connect_object('expose_event', self.do_expose, self.window)
self.drawing = drawing
label = Label(rgb_to_string(WHITE_RGB))
self.label = label
table = Table(2, 2, True)
table.attach(self.drawing, 0, 1, 0, 1)
table.attach(label, 0, 1, 1, 2)
table.attach(grab_btn, 1, 2, 0, 1)
table.attach(exit_btn, 1, 2, 1, 2)
self.window.add(table)
示例2: life_cb
# 需要导入模块: from gtk import Button [as 别名]
# 或者: from gtk.Button import connect_object [as 别名]
def life_cb(widget, event):
gtk.main_quit()
def other_cb(widget, event):
gtk.main_quit()
window = Window(gtk.WINDOW_TOPLEVEL)
window.connect("destroy", gtk.main_quit)
box = gtk.VBox(False, 0)
stamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
btn_same = Button("SAME")
btn_same.connect_object("button_press_event", same_cb, window)
box.pack_start(btn_same, True, True, 0)
btn_project = Button("project")
btn_project.connect_object("button_press_event", project_cb, window)
box.pack_start(btn_project, True, True, 0)
btn_study = Button("study")
btn_study.connect_object("button_press_event", study_cb, window)
box.pack_start(btn_study, True, True, 0)
btn_life = Button("life")
btn_life.connect_object("button_press_event", life_cb, window)
box.pack_start(btn_life, True, True, 0)
btn_other = Button("other")