|
@@ -28,19 +28,21 @@ class Graph(tk.Canvas):
|
|
|
self.bind("<Configure>", self.on_resize)
|
|
|
|
|
|
def drawBackground(self):
|
|
|
- self.bg = Image.new('RGB', (self.width, self.height), (0,20,0))
|
|
|
+ self.bg = Image.new('RGB', (self.width, self.height), (0,10,0))
|
|
|
draw = ImageDraw.Draw(self.bg)
|
|
|
# draw x and y axis
|
|
|
axes = self.pointToCoord((0, 0))
|
|
|
draw.line([(0, axes[1]), (self.width, axes[1])], (60,127,127), self.lineWidth)
|
|
|
draw.line([(axes[0], 0), (axes[0], self.height)], (60,127,127), self.lineWidth)
|
|
|
-
|
|
|
- # draw ticks
|
|
|
for p in range(self.scale[0], self.scale[1], 10**int(math.log10(self.scale[1]-self.scale[0]))):
|
|
|
tickPosX = self.pointToCoord((p, 0))
|
|
|
tickPosY = self.pointToCoord((0, p))
|
|
|
- draw.line([(tickPosX[0], tickPosX[1]+self.lineWidth*300), (tickPosX[0], tickPosX[1]-self.lineWidth*300)], (60,127,127), int(self.lineWidth/2))
|
|
|
- draw.line([(tickPosY[0]+self.lineWidth*300, tickPosY[1]), (tickPosY[0]-self.lineWidth*300, tickPosY[1])], (60,127,127), int(self.lineWidth/2))
|
|
|
+ #draw grid
|
|
|
+ draw.line([(tickPosX[0], self.height), (tickPosX[0], 0)], (60,127,60), 1)
|
|
|
+ draw.line([(self.width, tickPosY[1]), (0, tickPosY[1])], (60,127,60), 1)
|
|
|
+ # draw ticks
|
|
|
+ draw.line([(tickPosX[0], tickPosX[1]+self.lineWidth*3), (tickPosX[0], tickPosX[1]-self.lineWidth*3)], (60,127,100), int(self.lineWidth/2))
|
|
|
+ draw.line([(tickPosY[0]+self.lineWidth*3, tickPosY[1]), (tickPosY[0]-self.lineWidth*3, tickPosY[1])], (60,127,100), int(self.lineWidth/2))
|
|
|
# draw tick labels
|
|
|
draw.text((tickPosX[0]+3, tickPosX[1]+self.lineWidth*4), str(p) + " mm", font=self.font)
|
|
|
if p != 0:
|