MCPcopy Create free account
hub / github.com/ActiveState/code / build_graph

Function build_graph

recipes/Python/502240_Boids_Version_11/recipe-502240.py:27–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25 build_graph()
26
27def build_graph():
28 # Build GUI environment.
29 global graph
30 root = Tk()
31 if WINDOWED:
32 root.resizable(False, False)
33 root.title('Boids')
34 else:
35 root.overrideredirect(True)
36 x = (root.winfo_screenwidth() - WIDTH) / 2
37 y = (root.winfo_screenheight() - HEIGHT) / 2
38 root.geometry('%dx%d+%d+%d' % (WIDTH, HEIGHT, x, y))
39 root.bind_all('<Escape>', lambda event: event.widget.quit())
40 graph = Canvas(root, width=WIDTH, height=HEIGHT, background='white')
41 graph.after(1000 / FRAMES_PER_SEC, update)
42 graph.pack()
43
44def update():
45 # Main simulation loop.

Callers 1

initialiseFunction · 0.70

Calls 5

TkClass · 0.50
titleMethod · 0.45
quitMethod · 0.45
afterMethod · 0.45
packMethod · 0.45

Tested by

no test coverage detected