add number_circle
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
from .base import View
|
||||
|
||||
class NumberView(View):
|
||||
|
||||
def _init_canvas(self):
|
||||
self.label = self.canvas.create_text(50, 68, text="0.0 g", font=("Arial", 18), fill='black', justify='left')
|
||||
|
||||
def update_weight(self, weight):
|
||||
self.canvas.itemconfig(self.label, text=f"{weight:.1f} g")
|
||||
im = self.bkg_im.copy()
|
||||
im_draw = ImageDraw.Draw(im)
|
||||
im_draw.text((50, 68), f"{weight:.1f} g",
|
||||
fill='black', font_size=24)
|
||||
return im
|
||||
|
||||
Reference in New Issue
Block a user