add tgt weight display
This commit is contained in:
@@ -60,8 +60,8 @@ class WeightApp(tk.Tk):
|
||||
continue
|
||||
|
||||
var = tk.BooleanVar()
|
||||
if display_type == DISPLAY_TYPES.NUMBER:
|
||||
var.set(True) # Default to NUMBER view
|
||||
var.set(True) # Default to all enabled
|
||||
|
||||
checkbox = ttk.Checkbutton(self.view_type, text=display_type.name, variable=var)
|
||||
checkbox.pack()
|
||||
self.view_vars[display_type] = var
|
||||
|
||||
@@ -31,7 +31,13 @@ class CircleView(View):
|
||||
bkg_im = self.bkg_im.copy()
|
||||
try:
|
||||
target = float(self.target.get())
|
||||
weight_radius = weight / target * self.target_radius
|
||||
if target > 0:
|
||||
draw = ImageDraw.Draw(bkg_im)
|
||||
draw.text((60, 98), f"{target:.1f} g", fill='black', font_size=16)
|
||||
|
||||
weight_radius = weight / target * self.target_radius
|
||||
else:
|
||||
return bkg_im
|
||||
|
||||
im = Image.new('1', self.size, 'black')
|
||||
draw = ImageDraw.Draw(im)
|
||||
|
||||
@@ -151,16 +151,18 @@ class MainView(tk.Frame):
|
||||
self.right_press_job = None
|
||||
self.right_button_long_press()
|
||||
|
||||
|
||||
############ BUTTON ACTIONS ###########
|
||||
|
||||
def left_button_press(self):
|
||||
self.tare_command()
|
||||
|
||||
def right_button_press(self):
|
||||
self.timer_view.toggle_timer()
|
||||
|
||||
def left_button_long_press(self):
|
||||
"""Handle long press on left button"""
|
||||
print("Left button long press") # Replace with your logic
|
||||
pass
|
||||
self.timer_view.reset_timer()
|
||||
|
||||
|
||||
def right_button_press(self):
|
||||
self.tare_command()
|
||||
|
||||
def right_button_long_press(self):
|
||||
self.timer_view.reset_timer()
|
||||
pass
|
||||
Reference in New Issue
Block a user