maze-solver/main.py
Dan Anglin a919c2698b
perf: reduce CPU usage whilst idle
When the Maze Solver was idle the wait_for_close() loop ran which
continuously redrew the window in an infinite while loop. This caused
the CPU usage to spike between 70%-80%. This commit removes that method
and uses the _root.mainloop() instead to keep the window visible on the
screen. With this the CPU usage has dropped to > 1% when idle.
2024-02-15 01:40:16 +00:00

22 lines
350 B
Python

from graphics import Window
from maze import Maze
def main():
window = Window(800, 800)
_ = Maze(
x_position=10,
y_position=10,
num_cell_rows=30,
num_cells_per_row=30,
cell_size_x=20,
cell_size_y=20,
window=window
)
window.mainloop()
if __name__ == "__main__":
main()