def createButtons(amount):
print ("[GUI] Creating " + str(amount) + " buttons")
for i in range(1, amount + 1):
#Add the buttons to the window class
setattr(win, "prediction" + str(i), Gtk.Button(label = "Prediction #" + str(i)))
#Add the buttons to the box
win.box.pack_start(getattr(win, "prediction" + str(i)), True, True, 0)
#Connect the buttons clicked event to the on_prediction_click function
getattr(win, "prediction" + str(i)).connect("clicked", on_prediction_click, i)
评论列表
文章目录