Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #12605

How do I make a Fitbit dashboard in Python?

Newsgroups comp.programming
Date 2021-05-12 13:25 -0700
Message-ID <ba9f5378-0f8d-4178-80a0-d2dedbd3469en@googlegroups.com> (permalink)
Subject How do I make a Fitbit dashboard in Python?
From s7382 <s35587079@gmail.com>

Show all headers | View raw


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?

Back to comp.programming | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

How do I make a Fitbit dashboard in Python? s7382 <s35587079@gmail.com> - 2021-05-12 13:25 -0700
  Re: How do I make a Fitbit dashboard in Python? Härra Ramob <ya12983@mail.com> - 2022-01-05 00:33 -0800

csiph-web