grid = containers.Grid() grid.add_widgets([(self.iv, 2, 1, True, True), containers.Grid.NEW_ROW, (button1, 1, 1, True, False), (button2, 1, 1, True, False), containers.Grid.NEW_ROW, (button3, 1, 1, True, False), (button4, 1, 1, True, False)]) self.add(grid) grid.show() self.set_default_size(700, 600) def on_button1_clicked(self, widget): print(self.iv.get_selection_list()) def on_button2_clicked(self, widget): self.iv.set_selection_list([(25, 10, 45, 60)]) def on_button3_clicked(self, widget): self.iv.zoom_in() def on_button4_clicked(self, widget): self.iv.zoom_out() if __name__ == "__main__": win = TestWindow() win.connect("delete-event", lambda x, y: loop.stop_main_loop()) win.show_all() loop.start_main_loop()
def close(self,*data): loop.stop_main_loop()
button4 = widget.Button(label="Zoom-Out") button4.connect_function(self.on_button4_clicked) grid = containers.Grid() grid.add_widgets([(self.iv,2,1,True,True),containers.Grid.NEW_ROW, (button1,1,1,True,False),(button2,1,1,True,False),containers.Grid.NEW_ROW, (button3,1,1,True,False),(button4,1,1,True,False)]) self.add(grid) grid.show() self.set_default_size(700,600); def on_button1_clicked(self, widget): print(self.iv.get_selection_list()) def on_button2_clicked(self, widget): self.iv.set_selection_list([(25,10,45,60)]) def on_button3_clicked(self, widget): self.iv.zoom_in() def on_button4_clicked(self, widget): self.iv.zoom_out() if __name__ == "__main__": win = TestWindow() win.connect("delete-event", lambda x,y : loop.stop_main_loop()) win.show_all() loop.start_main_loop()