repl.it
Tkinter

No description

fork
loading
Files
  • main.py
  • nohup.out
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from tkinter import *
import random

root = Tk()

canvas = Canvas(root)
canvas.pack()
'''
5 circles
5 polygons
5 line commands
2 for loops
1 global variable
'''
def create_circle(x, y, r, color, canvas):
    x0 = x - r
    y0 = y - r
    x1 = x + r
    y1 = y + r
    return canvas.create_oval(x0, y0, x1, y1, fill=color)

counter = 0
while counter < 5:
	randomPos1 = random.randint(1,200)
	randomPos2 = random.randint(1,200)
	randomRadius = random.randint(10,20)

	create_circle(randomPos1, randomPos2, randomRadius, "red", canvas)
	counter = counter + 1

root.mainloop()
Fetching token
?