0
This is my GUI. My GUI app
Code for GUI (frontend):
from tkinter import *
from tk_tools import *
from tkinter.ttk import *
from tkinter import messagebox
root=Tk()
def add_alarm():
if not hrEntry.get()=='' and not minEntry.get()=='': messagebox.showinfo('Success', 'Successfully added alarm')
else:
messagebox.showerror('Error', 'Value(s) are invalid')
root.title('Fitbit Dashboard')
root.grid()
hr=RotaryScale(root, max_value=(220-age), unit=' BPM Heart rate') steps=Gauge(root, max_value=10000, label='steps', unit='', red_low=20, yellow_low=30, red=100, yellow=100)
steps.grid(column=2, row=1)
cals=Gauge(root, max_value=2400, label='calories', unit='', red_low=20, yellow_low=30, red=100, yellow=100)
cals.grid(column=4, row=1)
dist=Gauge(root, max_value=5, label='distance', unit=' mi', red_low=20, yellow_low=30, red=100, yellow=100)
dist.grid(column=3, row=1)
actmins=Gauge(root, max_value=30, label='active minutes', unit='', red_low=20, yellow_low=30, red=100, yellow=100)
actmins.grid(column=5, row=1)
hr.grid(column=1, row=1)
hr.set_value(0)
hrEntry=Spinbox(root, from_=0, to=23, state='readonly') hrEntry.grid(column=7, row=1)
minEntry=Spinbox(root, from_=0, to=59, state='readonly') minEntry.grid(column=8, row=1)
addbutton=Button(root, text='Add Alarm', command=add_alarm) addbutton.grid(column=9, row=1)
lo_bat=Led(root, size=50)
lo_bat.grid(column=4, row=2)
lo_bat.to_red(on=False)
Label(root, text='Battery low when lit').grid(column=4, row=3)
Pseudocode for backend:
def add_alarm():
if both textboxes are filled:
add alarm to fitbit and notify user via messagebox
else:
show an error message via messagebox
while True:
set cals needle to cals burned
set steps needle to steps
set heart needle to current heart rate
set active minutes needle to active minutes
set distance needle to distance walked
if battery<=17:
turn on LED
else:
turn off LED
How do I turn the needles of the gauges on my GUI according to Fitbit stats, light the low battery indicator when the Fitbit's battery runs low, and add an alarm when pressing the "Add Alarm" button? In other words, how do I do my pseudocode in Python?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 403 |
Nodes: | 16 (2 / 14) |
Uptime: | 112:28:32 |
Calls: | 8,465 |
Calls today: | 2 |
Files: | 13,181 |
Messages: | 5,910,008 |