title: How to detect rectangles next to each other in Python using tkinter
body: <p>I am new to tkinter but am trying to make a program where a rectangle AI will navigate a maze of other rectangles, however I'm not sure what is the best way to detect the rectangles around my AI so it can find openings and figure out where to go (like look left and right to see if there are rectangles)</p>
  
  <p>I tried making collisions but I could not get that to work very well, but I'm also not making each maze wall into it's own variable so I don't know how to check if it's coordinates relate to the AI's. So maybe see if there is anything "AIPossition_x + 5" or something similar?</p>
  
  <p>This is the code I'm using now</p>
  
  <pre class="lang-py prettyprint-override"><code>maze_create_x = 25
  maze_create_y = 25
  
  for char in maze:
      if char == "+":
          canvas.create_rectangle(maze_create_x, maze_create_y, maze_create_x + 25, maze_create_y + 25, fill="black")
      elif char == "/":
          maze_create_y += 25
          maze_create_x = 0
      maze_create_x += 25
  
  
  robot = canvas.create_rectangle(80, 55, 95, 70, fill="blue")
  </code></pre>
  
  <p>I want the "robot" AI to be able to see if there is a rectangle in front, left, or right of it but I'm not sure where to even start. Thanks for all the help!</p>