# 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
        self.top.update_idletasks()
        w = self.top.winfo_screenwidth()
        h = self.top.winfo_screenheight()
        size = tuple(int(_)
                     for _ in self.top.geometry().split('+')[0].split('x'))
        x = w / 2 - size[0] / 2
        y = h / 2 - size[1] / 2
        self.top.geometry("%dx%d+%d+%d" % (size + (x, y)))

    def move_frame(self, x, y):
        self.top.update_idletasks()
        size = tuple(int(_)
                     for _ in self.top.geometry().split('+')[0].split('x'))
        self.top.geometry("%dx%d+%d+%d" % (size + (x, y)))

    def t_x(self, x):
        return self.dist_to_pixel * (x + self.dist_width / 2.)

    def t_y(self, y):
        return self.ground_height - self.dist_to_pixel * y

    def draw_block(self, block, x):
        self.blocks.append(self.canvas.create_rectangle(self.t_x(x - block.w / 2.), self.t_y(0),
                                                        self.t_x(
                                                            x + block.w / 2.), self.t_y(block.h),
                                                        fill=block.color, outline='black', width=2))

    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(

# 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

        self.top.update_idletasks()
        w = self.top.winfo_screenwidth()
        h = self.top.winfo_screenheight()
        size = tuple(int(_)
                     for _ in self.top.geometry().split('+')[0].split('x'))
        x = w / 2 - size[0] / 2
        y = h / 2 - size[1] / 2
        self.top.geometry("%dx%d+%d+%d" % (size + (x, y)))

    def move_frame(self, x, y):
        self.top.update_idletasks()
        size = tuple(int(_)
                     for _ in self.top.geometry().split('+')[0].split('x'))
        self.top.geometry("%dx%d+%d+%d" % (size + (x, y)))

    def t_x(self, x):
        return self.dist_to_pixel * (x + self.dist_width / 2.)

    def t_y(self, y):
        return self.ground_height - self.dist_to_pixel * y

    def draw_block(self, block, x):
        self.blocks.append(self.canvas.create_rectangle(self.t_x(x - block.w / 2.), self.t_y(0),
                                                        self.t_x(
                                                            x + block.w / 2.), self.t_y(block.h),
                                                        fill=block.color, outline='black', width=2))

    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),