|
@@ -1,9 +1,9 @@
|
|
|
import tkinter as tk
|
|
|
import time, math
|
|
|
-from PIL import Image, ImageDraw, ImageTk
|
|
|
+from PIL import Image, ImageDraw, ImageTk, ImageFont
|
|
|
|
|
|
class Graph(tk.Canvas):
|
|
|
- def __init__(self, root, scale=(-100, 500), **kwargs):
|
|
|
+ def __init__(self, root, scale=(-100, 550), **kwargs):
|
|
|
self.root = root
|
|
|
tk.Canvas.__init__(self, root, **kwargs)
|
|
|
self.height = self.winfo_reqheight()
|
|
@@ -11,6 +11,7 @@ class Graph(tk.Canvas):
|
|
|
self.lastPoints = [(0, 0)] * 3
|
|
|
self.scale = scale
|
|
|
self.colors = [(100, 255, 100, 255), (255, 100, 100, 255) ,(100, 100, 255, 255)]
|
|
|
+ self.font = ImageFont.truetype("gui/SourceSansPro-Semibold.otf", 12)
|
|
|
self.lineWidth = 1
|
|
|
|
|
|
self.drawBackground()
|
|
@@ -36,9 +37,9 @@ class Graph(tk.Canvas):
|
|
|
draw.line([(tickPosX[0], tickPosX[1]+self.lineWidth*3), (tickPosX[0], tickPosX[1]-self.lineWidth*3)], (60,127,127), int(self.lineWidth/2))
|
|
|
draw.line([(tickPosY[0]+self.lineWidth*3, tickPosY[1]), (tickPosY[0]-self.lineWidth*3, tickPosY[1])], (60,127,127), int(self.lineWidth/2))
|
|
|
|
|
|
- draw.text((tickPosX[0]+3, tickPosX[1]+self.lineWidth*4), str(p) + " mm")
|
|
|
+ draw.text((tickPosX[0]+3, tickPosX[1]+self.lineWidth*4), str(p) + " mm", font=self.font)
|
|
|
if p != 0:
|
|
|
- draw.text((tickPosY[0]-self.lineWidth*4-30, tickPosY[1]), str(p) + " mm")
|
|
|
+ draw.text((tickPosY[0]-self.lineWidth*4-35, tickPosY[1]), str(p) + " mm", font=self.font)
|
|
|
|
|
|
def on_resize(self,event):
|
|
|
self.width = max(100, event.width-4)
|