Files
frontend-dev/frontend/views/base.py
2025-05-05 23:37:07 +02:00

27 lines
845 B
Python

from tkinter import ttk, Frame, Canvas
class View(Frame):
def __init__(self, *args, tare_command=None, calibrate_command=None, **kwargs):
super().__init__(*args, **kwargs)
self.actions = Frame(self)
self.actions.pack()
self.calibrate_button = ttk.Button(self.actions, text="Calibrate", command=calibrate_command)
self.calibrate_button.pack()
self.tare_button = ttk.Button(self.actions, text="Tare", command=tare_command)
self.tare_button.pack()
self.canvas = Canvas(self, width=144, height=168, background='white')
self.canvas.pack()
self.center = (144 // 2, 168 // 2)
self._init_canvas()
def _init_canvas(self):
raise NotImplementedError()
def update_weight(self, weight: float):
raise NotImplementedError()