-
Notifications
You must be signed in to change notification settings - Fork 0
/
board_2.py
69 lines (50 loc) · 2.03 KB
/
board_2.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import tkinter as tk
from tkinter import *
x=0
myWindow=tk.Tk()
myWindow.title("Archery Board")
myWindow.geometry('1750x1000')
myWindow.resizable(True,True)
myCanvas = Canvas(myWindow,bd=5,bg='grey',width=1675,height=925)
myCanvas.place(height='950',width='1700')
def Board(myCanvas):
x1 = 1150
y1 = 200
x2 = 1370
y2 = 500
Colour = ["white","white",'black','black',"blue","blue","red","red","yellow","yellow","yellow"]
for n in range (10):
myCanvas.create_oval(x1,y1,x2,y2,fill = Colour[n])
x1+=10
y1+=10
x2-=10
y2-=10
myCanvas.create_oval(1180,230,1340,470,width=1,outline = "white")
myCanvas.create_oval(1250,300,1270,400,fill='yellow',dash = (1,3))
myCanvas.create_line(1255,350,1265,350,width=1)
myCanvas.create_line(1260,345,1260,355,width=1)
def Numbers(myCanvas):
x = 1275
for n in range (10,0,-1):
myCanvas.create_text(x,350,text = n,fill="orange",font = ("times",9))
x+=10
def arrow_coordinates(event):
my_label_x['text']=str(event.x)+","+str(event.y)
def motion_coordinates(event):
my_motion_x['text']=str(event.x)+","+str(event.y)
myCanvasMouse=Canvas(myWindow,bd=5,bg='blue')
#myCanvasMouse.place( x=100, y=100, width=320, height=320)
#myCanvasMouseView=Label(relief="solid",font="Times 22 bold",bg="white",fg="black")
my_label_x=Label(relief="solid",font="Times 22 bold",bg="white",fg="black")
myCanvas.bind('<Button-1>',arrow_coordinates)
#myCanvas.place(x=200,y=450,width=100,height=50)
my_label_x.place(x=100,y=330,width=125,height=50)
#myCanvasMouseMotion=Label(relief="solid",font="Times 22 bold",bg="white",fg="black")
my_motion_x=Label(relief="solid",font="Times 22 bold",bg="white",fg="black")
myCanvas.bind('<Motion>',motion_coordinates)
#myCanvasMouseMotion.place(x=300,y=450,width=100,height=50)
my_motion_x.place(x=200,y=330,width=125,height=50)
Board(myCanvas)
Numbers(myCanvas)
myWindow.mainloop()
myCanvas.create_text()