# 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.height = height
        self.canvas = Canvas(self.top, width=self.width,
                             height=self.height, background=background)
        self.canvas.pack()

        self.move_frame(self.tl_x, self.tl_y)

        self.dist_to_pixel = (
            self.width - 2 * PIXEL_BUFFER) / (self.env_region.w)
        self.dist_width = self.width / self.dist_to_pixel
        self.dist_height = self.height / self.dist_to_pixel
        self.ground_height = self.height - self.dist_to_pixel * ENV_HEIGHT
        self.robot_dist = self.dist_height / 2.

        self.robot = []
        self.blocks = []
        self.holding = None
        self.draw_environment()

    def center(self):
        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):

# 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.height = height
        self.canvas = Canvas(self.top, width=self.width,
                             height=self.height, background=background)
        self.canvas.pack()

        self.move_frame(self.tl_x, self.tl_y)

        self.dist_to_pixel = (
            self.width - 2 * PIXEL_BUFFER) / (self.env_region.w)
        self.dist_width = self.width / self.dist_to_pixel
        self.dist_height = self.height / self.dist_to_pixel
        self.ground_height = self.height - self.dist_to_pixel * ENV_HEIGHT
        self.robot_dist = self.dist_height / 2.

        self.robot = []
        self.blocks = []
        self.holding = None
        self.draw_environment()

    def center(self):
        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()