def set_obstacle_GUI(self, g_row, g_col): with self.wid.canvas: if (g_row != self.source_r_GUI or g_col != self.source_c_GUI) and ( g_row != self.target_r_GUI or g_col != self.target_c_GUI): Color(0, .5, .5, mode='rgb') Rectangle(pos=(g_row * 50, g_col * 50), size=(45, 45)) A_Star.obstacle_list.add( (self.corrected_row[g_col], int(g_row))) A_Star.test_print()
def show_path(self, instance): print("button used") A_Star.calculate() grid = A_Star.grid timer = 0.1 for i in grid: for j in i: if j.path: print('path maker ', j.row, j.col) Clock.schedule_once(partial(self.color_it, j), timer) timer += 0.1
def show_path(self, instance): print("button used") A_Star.calculate() grid = A_Star.grid for i in grid: for j in i: if j.path: print('path maker ', j.row, j.col) with self.wid.canvas: Color(1, 1, 0, .4, mode='rgba') Rectangle(pos=(j.col * 50, self.corrected_row[j.row] * 50), size=(45, 45))
def reset_grid(self, instance): self.wid.canvas.clear() self.create_grid() self.count = 0 A_Star.reset()