-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEdge.py
More file actions
37 lines (30 loc) · 808 Bytes
/
Edge.py
File metadata and controls
37 lines (30 loc) · 808 Bytes
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
from tkinter import *
import graph
from Node import Node
class Edge():
Drawing = None
@staticmethod
def init(Drawing):
"""
:param Drawing:
:type Drawing: graph.Drawing
"""
Edge.Drawing = Drawing
def __init__(self, n1, n2):
"""
:param n1:
:type n1: Node
:param n2:
:type n2: Node
:param Drawing:
:type Drawing: graph.Drawing
"""
self.n1 = n1
self.n2 = n2
self.isDelted = False
self.line = Edge.Drawing.line(n1.p, n2.p)
def move(self):
Edge.Drawing.canvas.coords( self.line, [self.n1.p[0], self.n1.p[1], self.n2.p[0], self.n2.p[1]] )
def delete(self):
self.isDelted = True
Edge.Drawing.canvas.delete(self.line)