def draw_patch_box(x, y):
    patch_box = Rectangle(Point(x, y), Point(x + 100, y + 100))
    patch_box.setWidth(5)
    return patch_box
Ejemplo n.º 2
0
pathLength_text.setStyle("bold")
pathLength_text.draw(win)

pathCost_text = Text(Point(100, 460), "Path Cost Score: ")
pathCost_text.setTextColor(color="white")
pathCost_text.setSize(10)
pathCost_text.setStyle("bold")
pathCost_text.draw(win)

pathCost_text = Text(Point(175, 460), '')
pathCost_text.setTextColor(color="white")
pathCost_text.setSize(10)
pathCost_text.setStyle("bold")
pathCost_text.draw(win)

a_rect = Rectangle(Point(1300, 400), Point(1350, 450))
a_rect.setOutline(color="white")
a_rect.setWidth(3)
a_rect.draw(win)

# white_rect = Rectangle(Point(950,400),Point(1000,450))
# white_rect.setOutline(color="white")
# white_rect.setFill(color="white")
# white_rect.draw(win)

Astar_text = Text(Point(1325, 425), "A*")
Astar_text.setSize(25)
# Astar_text = Text(Point(1325,425), "BFS")
# Astar_text.setSize(15)
# Astar_text = Text(Point(1325,425), "DiJ")
# Astar_text.setSize(15)
Ejemplo n.º 3
0
 def draw_bb(self, lowx, lowy, highx, highy):
     (gx, gy) = self.cell_coord(lowx, lowy)
     (gx2, gy2) = self.cell_coord(highx, highy)
     box = Rectangle(Point(gx, gy), Point(gx2, gy2))
     box.set
def chart(ach_classes):
    """
    Create a chart of all Achievements, five at a time.

    Parameters
    ----------
    ach_classes : list
        A list of Achievement class objects.

    """
    if len(ach_classes) > 5:
        win = GraphWin("Achievement List", 500, 500)
        win.setBackground(color_rgb(200, 200, 200))

        Rectangle(Point(0, 0), Point(500, 80)).draw(win)
        Rectangle(Point(0, 80), Point(500, 160)).draw(win)
        Rectangle(Point(0, 160), Point(500, 240)).draw(win)
        Rectangle(Point(0, 240), Point(500, 320)).draw(win)
        Rectangle(Point(0, 320), Point(500, 400)).draw(win)
        fill_y = 0
        name_y = 55
        perc_y = 70

        for i in ach_classes[0:5]:
            i_fill = Rectangle(Point(0, fill_y),
                               Point(5 * float(i.percent), fill_y + 80))
            i_fill.setFill("green")
            i_fill.draw(win)

            Text(Point(250, name_y), i.name).draw(win)
            Text(Point(250, perc_y), f"{i.percent}%").draw(win)

            fill_y += 80
            name_y += 80
            perc_y += 80

        Text(Point(250, 450), "Click anywhere to continue...").draw(win)
        win.getMouse()
        win.close()
        del ach_classes[0:5]
        chart(ach_classes)
    else:
        win = GraphWin("Achievement List", 500, 500)
        win.setBackground(color_rgb(200, 200, 200))

        Rectangle(Point(0, 0), Point(500, 80)).draw(win)
        Rectangle(Point(0, 80), Point(500, 160)).draw(win)
        Rectangle(Point(0, 160), Point(500, 240)).draw(win)
        Rectangle(Point(0, 240), Point(500, 320)).draw(win)
        Rectangle(Point(0, 320), Point(500, 400)).draw(win)
        fill_y = 0
        name_y = 55
        perc_y = 70
        for i in ach_classes:
            i_fill = Rectangle(Point(0, fill_y),
                               Point(5 * float(i.percent), fill_y + 80))
            i_fill.setFill("green")
            i_fill.draw(win)

            Text(Point(250, name_y), i.name).draw(win)
            Text(Point(250, perc_y), f"{i.percent}%").draw(win)

            fill_y += 80
            name_y += 80
            perc_y += 80
        Text(Point(250, 450),
             "List complete. Click anywhere to close.").draw(win)
        win.getMouse()
        win.close()