# Path: stripstream/pddl/examples/continuous_tamp/continuous_tamp_utils.py
# SUCTION_WIDTH = 1.5
# 
# SUCTION_HEIGHT = 1.
# 
# STEM_WIDTH = 1.
# 
# STEM_HEIGHT = 2.5


from Tkinter import Tk, Canvas, Toplevel
from stripstream.pddl.examples.continuous_tamp.continuous_tamp_utils import SUCTION_WIDTH, SUCTION_HEIGHT, STEM_WIDTH,  STEM_HEIGHT
        from PIL import ImageGrab
    def draw_holding(self, block, x):
        self.holding = self.canvas.create_rectangle(self.t_x(x - block.w / 2.), self.t_y(self.robot_dist - SUCTION_HEIGHT / 2 - block.h),
                                                    self.t_x(
                                                        x + block.w / 2.), self.t_y(self.robot_dist - SUCTION_HEIGHT / 2),
                                                    fill=block.color, outline='black', width=2)

    def draw_region(self, region):
        self.environment.append(self.canvas.create_rectangle(self.t_x(region.x - region.w / 2.), self.ground_height,
                                                             self.t_x(
                                                                 region.x + region.w / 2.), self.height,
                                                             fill='red', outline='black', width=2))

    def draw_environment(self, table_color='lightgrey', bin_color='grey'):
        self.environment = [
            self.canvas.create_rectangle(self.t_x(-self.env_region.w / 2), self.ground_height,
                                         self.t_x(self.env_region.w /
                                                  2), self.height,
                                         fill=table_color, outline='black', width=2)
        ]
        for region in self.regions:
            self.draw_region(region)

    def draw_robot(self, x, color='yellow'):
        self.robot = [
            self.canvas.create_rectangle(self.t_x(x - SUCTION_WIDTH / 2.), self.t_y(self.robot_dist - SUCTION_HEIGHT / 2.),
                                         self.t_x(
                x + SUCTION_WIDTH / 2.), self.t_y(self.robot_dist + SUCTION_HEIGHT / 2.),
                fill=color, outline='black', width=2),
            self.canvas.create_rectangle(self.t_x(x - STEM_WIDTH / 2.), self.t_y(self.robot_dist + SUCTION_HEIGHT / 2.),
                                         self.t_x(

# Path: stripstream/pddl/examples/continuous_tamp/continuous_tamp_utils.py
# SUCTION_WIDTH = 1.5
# 
# SUCTION_HEIGHT = 1.
# 
# STEM_WIDTH = 1.
# 
# STEM_HEIGHT = 2.5


# Path: stripstream/pddl/examples/continuous_tamp/continuous_tamp_viewer.py
from Tkinter import Tk, Canvas, Toplevel
from stripstream.pddl.examples.continuous_tamp.continuous_tamp_utils import SUCTION_WIDTH, SUCTION_HEIGHT, STEM_WIDTH,  STEM_HEIGHT
        from PIL import ImageGrab

    def draw_holding(self, block, x):
        self.holding = self.canvas.create_rectangle(self.t_x(x - block.w / 2.), self.t_y(self.robot_dist - SUCTION_HEIGHT / 2 - block.h),
                                                    self.t_x(
                                                        x + block.w / 2.), self.t_y(self.robot_dist - SUCTION_HEIGHT / 2),
                                                    fill=block.color, outline='black', width=2)

    def draw_region(self, region):
        self.environment.append(self.canvas.create_rectangle(self.t_x(region.x - region.w / 2.), self.ground_height,
                                                             self.t_x(
                                                                 region.x + region.w / 2.), self.height,
                                                             fill='red', outline='black', width=2))

    def draw_environment(self, table_color='lightgrey', bin_color='grey'):
        self.environment = [
            self.canvas.create_rectangle(self.t_x(-self.env_region.w / 2), self.ground_height,
                                         self.t_x(self.env_region.w /
                                                  2), self.height,
                                         fill=table_color, outline='black', width=2)
        ]
        for region in self.regions:
            self.draw_region(region)

    def draw_robot(self, x, color='yellow'):
        self.robot = [
            self.canvas.create_rectangle(self.t_x(x - SUCTION_WIDTH / 2.), self.t_y(self.robot_dist - SUCTION_HEIGHT / 2.),
                                         self.t_x(
                x + SUCTION_WIDTH / 2.), self.t_y(self.robot_dist + SUCTION_HEIGHT / 2.),
                fill=color, outline='black', width=2),
            self.canvas.create_rectangle(self.t_x(x - STEM_WIDTH / 2.), self.t_y(self.robot_dist + SUCTION_HEIGHT / 2.),
                                         self.t_x(

                x + STEM_WIDTH / 2.), self.t_y(self.robot_dist + SUCTION_HEIGHT / 2. + STEM_HEIGHT),