Ejemplo n.º 1
0
def terminer(datedebut, nomprogramme, db, fenetre, canvas):
    canvas.delete('all')
    fenetre.title('terminer')
    image = PhotoImage(file='image/fond.gif', master=fenetre)
    canvas.pack()
    canvas.create_image(550, 300, image=image)

    datefin = time()

    tempsecoulle = int((datefin - datedebut))
    seconde = tempsecoulle
    minute = 0

    if tempsecoulle >= 60:
        seconde = (tempsecoulle % 60)
        minute = tempsecoulle // 60

    temps = str(minute)+" min "+str(seconde)+" sec"
    texttemps = "Vous avez mis " + str(minute)+" minutes et " + str(seconde) + " secondes"
    date = strftime("%A %d %B %Y %H:%M")
    textdate = "Nous sommes le " + str(date)

    canvas.create_text(550, 100, text=textdate, font=("times new roman", 18))
    canvas.create_text(550, 200, text=texttemps, font=("times new roman", 18))

    button = Button(fenetre, text="Terminer", command=lambda: requete(db, temps, date, nomprogramme, fenetre, canvas), font=("times new roman", 20), background="#59C38D", borderwidth=0, activebackground="#2FB5A3")
    canvas.create_window(550, 500, window=button)

    menu.menu_footer(fenetre, canvas, db)

    fenetre.mainloop()
Ejemplo n.º 2
0
def choixmuscle(db, nomprogramme, textvalider, fenetre, canvas):
    global canvas_button
    global canvas_valider
    global canvas_om
    global canvas_muscle

    canvas.delete('all')
    fenetre.title('ajouter exercice au programme')

    image = PhotoImage(file='image/fond.gif', master=fenetre)
    canvas.pack()
    canvas.create_image(550, 300, image=image)

    vbar = Scrollbar(fenetre, orient=VERTICAL)
    button_accueil = Button(fenetre, text="Ne pas ajouter de nouvel exercice", command=lambda: accueil.accueil(db, fenetre, canvas, vbar), font=("times new roman", 14), background="#59C38D", borderwidth=0, activebackground="#2FB5A3")
    canvas.create_window(550, 50, window=button_accueil)

    canvas_muscle = canvas.create_text(550, 200, text="choisissez le groupe musculaire de l'exercice a ajouter :", font=("times new roman", 16))
    var_om = StringVar()
    var_om.set("muscle")
    listeOptions = ('abdominaux', 'biceps', 'dos', 'jambes', 'pectoraux', 'triceps')
    om = OptionMenu(fenetre, var_om, *listeOptions)
    om.config(font=("times new roman", 14), background="#59C38D", borderwidth=0, activebackground="#2FB5A3")
    canvas_om = canvas.create_window(550, 250, window=om)

    button = Button(fenetre, text="valider", command=lambda: exercice(db, var_om, fenetre, nomprogramme, canvas), font=("times new roman", 14), background="#59C38D", borderwidth=0, activebackground="#2FB5A3")
    canvas_button = canvas.create_window(550, 300, window=button)

    canvas_valider = canvas.create_text(550, 350, text=textvalider, font=("times new roman", 16), fill="red")

    menu.menu_footer(fenetre, canvas, db)
Ejemplo n.º 3
0
def ajout(db, nomprogramme, ligne, suite, fenetre, canvas):
    global canvas_button
    global canvas_om
    global canvas_muscle

    canvas.delete('all')
    fenetre.title('ajouter exercice programme')

    image = PhotoImage(file='image/fond.gif', master=fenetre)
    canvas.pack()
    canvas.create_image(550, 300, image=image)

    canvas_muscle = canvas.create_text(550, 200, text="choisissez le groupe musculaire de l'exercice a ajouter :", font=("times new roman", 16))
    var_om = StringVar()
    var_om.set("muscle")
    listeOptions = ('abdominaux', 'biceps', 'dos', 'jambes', 'pectoraux', 'triceps')
    om = OptionMenu(fenetre, var_om, *listeOptions)
    om.config(font=("times new roman", 14), background="#59C38D", borderwidth=0, activebackground="#2FB5A3")
    canvas_om = canvas.create_window(550, 250, window=om)

    button = Button(fenetre, text="valider", command=lambda: exercice(db, var_om, fenetre, nomprogramme, ligne, suite, canvas), font=("times new roman", 14), background="#59C38D", borderwidth=0, activebackground="#2FB5A3")
    button.pack()
    canvas_button = canvas.create_window(550, 300, window=button)

    menu.menu_footer(fenetre, canvas, db)
Ejemplo n.º 4
0
def main(db, fenetre, canvas, vbar):
    vbar.forget()
    canvas.delete('all')
    fenetre.title('supprimer exercice')

    image = PhotoImage(file='image/fond.gif', master=fenetre)
    canvas.pack()
    canvas.create_image(550, 300, image=image)

    muscle(db, fenetre, canvas)

    menu.menu_footer(fenetre, canvas, db)
Ejemplo n.º 5
0
def main(db, fenetre, canvas, vbar):
    vbar.forget()
    canvas.delete('all')
    fenetre.title('ajouter programme')

    image = PhotoImage(file='image/fond.gif', master=fenetre)
    canvas.pack()
    canvas.create_image(550, 300, image=image)

    ajouter(db, fenetre, canvas)

    menu.menu_footer(fenetre, canvas, db)
Ejemplo n.º 6
0
def afficherpause(pause, db, fenetre, canvas, ordre, nomprogramme, datedebut):
    if pause > 0:
        canvas.delete('all')
        fenetre.title('pause')
        image = PhotoImage(file='image/fond.gif', master=fenetre)
        canvas.pack()
        canvas.create_image(550, 300, image=image)

        timer = canvas.create_text(550, 300, text="", font=("times new roman", 26), justify=CENTER)
        updatepause(pause, timer, canvas, fenetre, db, ordre, nomprogramme, datedebut)

        menu.menu_footer(fenetre, canvas, db)
    else:
        afficher(nomprogramme, db, fenetre, canvas, ordre + 1, datedebut)
Ejemplo n.º 7
0
def accueil(db, fenetre, canvas, vbar):
    vbar.forget()
    fenetre.title('accueil')
    canvas.delete('all')
    image = PhotoImage(file='image/fond.gif', master=fenetre)
    canvas.create_image(550, 300, image=image)

    menu.menu_header(fenetre, db, canvas, vbar)
    canvas.create_text(
        550,
        250,
        text="Bienvenue dans l'application de sport à la maison",
        font=("times new roman", 20))
    menu.menu_footer(fenetre, canvas, db)
Ejemplo n.º 8
0
def apropos(db, fenetre, canvas):
    canvas.delete('all')
    fenetre.title('a propos')

    image = PhotoImage(file='image/fond.gif', master=fenetre)
    canvas.pack()

    canvas.create_image(550, 300, image=image)
    canvas.create_text(
        550,
        250,
        text=
        "Cette petite application a été réalisée dans le cadre d'une veille technologique par Elouan Jeannot",
        font=("times new roman", 20))
    menu.menu_footer(fenetre, canvas, db)
Ejemplo n.º 9
0
def afficher(nomprogramme, db, fenetre, canvas, ordre, datedebut):
    cur = db.cursor()
    query = 'SELECT exercice.nom, exercice.description, exercice.image, muscle.nom, programme_exercice.nombre_repetition, programme_exercice.temps, programme_exercice.pause FROM programme_exercice JOIN exercice ON programme_exercice.exercice = exercice.ID JOIN muscle ON exercice.muscle = muscle.ID WHERE programme = (SELECT ID FROM programme WHERE nom = ?) AND ordre= ?'
    try:
        cur.execute(query, (nomprogramme, ordre))
        for var in cur:
            row = var
        canvas.delete('all')
        fenetre.title('lire programme')
        image = PhotoImage(file='image/fond.gif', master=fenetre)
        canvas.pack()
        canvas.create_image(550, 300, image=image)

        canvas.create_text(550, 50, text=row[0], font=("times new roman", 18))
        canvas.create_text(550, 100, text=row[1], font=("times new roman", 14))

        cheminimage = "image/" + str(row[2]) + ".gif"
        try:
            im = Image.open(cheminimage)
        except:
            im = Image.open("image/default.gif")

        if im.size[1] >= 235:
            cover = resizeimage.resize_height(im, 235)
            cover.save(cheminimage, im.format)
        imageexercice = PhotoImage(file=cheminimage, master=fenetre)
        canvas.create_image(550, 235, image=imageexercice)

        if row[5] != 0:
            timer = canvas.create_text(550, 450, text="", font=("times new roman", 18), justify=CENTER)
            updatetime(db, row[5], timer, canvas, fenetre, row[6], ordre, nomprogramme, datedebut)
            menu.menu_footer(fenetre, canvas, db)

        elif row[4] != 0:
            repetition = "Vous devez faire \n " + str(row[4]) + " \n repetitions pour terminer l'exercice"
            canvas.create_text(550, 400, text=repetition, font=("times new roman", 18), justify=CENTER)

            button = Button(fenetre, text="Passer à l'exercice suivant",
                            command=lambda: afficherpause(row[6], db, fenetre, canvas, ordre, nomprogramme, datedebut),
                            font=("times new roman", 20), background="#59C38D", borderwidth=0,
                            activebackground="#2FB5A3")
            canvas.create_window(550, 500, window=button)
            menu.menu_footer(fenetre, canvas, db)

        else:
            afficherpause(row[6], db, fenetre, canvas, ordre, nomprogramme, datedebut)
            menu.menu_footer(fenetre, canvas, db)
    except:
        terminer(datedebut, nomprogramme, db, fenetre, canvas)
Ejemplo n.º 10
0
def modifier(db, muscle, nom, fenetre, canvas):

    if nom.get() == "exercice":
        raise Exception("Choisissez un exercice")

    global valider
    canvas.delete('all')
    fenetre.title('modifier exercice')

    image = PhotoImage(file='image/fond.gif', master=fenetre)
    canvas.pack()
    canvas.create_image(550, 300, image=image)

    canvas.create_text(300,
                       100,
                       text="changez le nom de l'exercice :",
                       font=("times new roman", 16))
    var_nom = StringVar()
    entry_nom = Entry(fenetre,
                      exportselection=0,
                      textvariable=var_nom,
                      width=40,
                      font=("times new roman", 14),
                      borderwidth=0)
    canvas.create_window(300, 150, window=entry_nom)

    canvas.create_text(800,
                       100,
                       text="changez la description de l'exercice :",
                       font=("times new roman", 16))
    var_description = StringVar()
    entry_description = Entry(fenetre,
                              exportselection=0,
                              textvariable=var_description,
                              width=40,
                              font=("times new roman", 14),
                              borderwidth=0)
    canvas.create_window(800, 150, window=entry_description)

    canvas.create_text(300,
                       300,
                       text="changez l'image de l'exercice :",
                       font=("times new roman", 16))
    var_image = StringVar()
    entry_image = Entry(fenetre,
                        exportselection=0,
                        textvariable=var_image,
                        width=40,
                        font=("times new roman", 14),
                        borderwidth=0)
    canvas.create_window(300, 350, window=entry_image)

    canvas.create_text(800,
                       300,
                       text="changez le muscle de l'exercice :",
                       font=("times new roman", 16))
    var_om = StringVar()
    listeOptions = ('abdominaux', 'biceps', 'dos', 'jambes', 'pectoraux',
                    'triceps')
    om = OptionMenu(fenetre, var_om, *listeOptions)
    om.config(font=("times new roman", 14),
              background="#59C38D",
              borderwidth=0,
              activebackground="#2FB5A3")
    canvas.create_window(800, 350, window=om)

    nom = nom.get()
    cur = db.cursor()
    query = 'SELECT exercice.nom, description, image, muscle.nom FROM exercice JOIN muscle ON exercice.muscle = muscle.ID WHERE exercice.nom= ? AND exercice.muscle=(SELECT ID FROM muscle where nom = ?)'
    parametre = (nom, muscle)
    cur.execute(query, parametre)
    for row in cur:
        var_nom.set(row[0])
        var_description.set(row[1])
        var_image.set(row[2])
        var_om.set(row[3])

    button = Button(
        fenetre,
        text="valider",
        command=lambda: requete(db, nom, muscle, var_nom, var_description,
                                var_image, var_om, canvas),
        font=("times new roman", 14),
        background="#59C38D",
        borderwidth=0,
        activebackground="#2FB5A3")
    canvas.create_window(550, 450, window=button)

    valider = canvas.create_text(550,
                                 500,
                                 text="",
                                 font=("times new roman", 16),
                                 fill="red")

    menu.menu_footer(fenetre, canvas, db)
Ejemplo n.º 11
0
def afficherprogramme(db, nomprogramme, ligne, fenetre, canvas):
    if nomprogramme == "programme":
        main(db)
        raise Exception("Veuillez choisir un programme")

    var = ""
    canvas.delete('all')
    fenetre.title('modifier programme')

    image = PhotoImage(file='image/fond.gif', master=fenetre)
    canvas.pack()
    canvas.create_image(550, 300, image=image)

    canvas.create_text(550, 50, text="changez le nom du programme :", font=("times new roman", 16))
    var_nomprogramme = StringVar()
    entry_nomprogramme = Entry(fenetre, exportselection=0, textvariable=var_nomprogramme, font=("times new roman", 14), borderwidth=0)
    canvas.create_window(550, 80, window=entry_nomprogramme)
    var_nomprogramme.set(nomprogramme)

    cur = db.cursor()
    query = 'SELECT nom, nombre_repetition, temps, pause, muscle FROM programme_exercice JOIN exercice ON programme_exercice.exercice = exercice.ID WHERE programme_exercice.programme=(SELECT ID FROM programme WHERE nom = ?) AND ordre = ?'
    cur.execute(query, (nomprogramme, ligne))

    for row in cur:
        var = row
    if var == "":
        aucunexercice = Button(fenetre, text="ajouter le premier exercice", command=lambda: ajout(db, var_nomprogramme, 0, "suivant"), font=("times new roman", 14), background="#59C38D", borderwidth=0, activebackground="#2FB5A3", width=30)
        canvas.create_window(550, 300, window=aucunexercice)
    else:
        cur.execute(query, (nomprogramme, ligne))
        for row in cur:
            listeOptions = []

            cur = db.cursor()
            query = 'SELECT nom FROM exercice WHERE muscle = ?'
            cur.execute(query, (row[4], ))
            for row1 in cur:
                listeOptions.append(row1[0])

            canvas.create_text(300, 150, text="changez le nom de l'exercice :", font=("times new roman", 16))
            var_nomex = StringVar()
            liste_ex = OptionMenu(fenetre, var_nomex, *listeOptions)
            liste_ex.config(font=("times new roman", 14), background="#59C38D", borderwidth=0, activebackground="#2FB5A3")
            canvas.create_window(300, 200, window=liste_ex)
            var_nomex.set(row[0])

            canvas.create_text(800, 150, text="choisissez le nombre de répetition ou le temps :", font=("times new roman", 16))
            value_reptemps = IntVar()
            reptemps = Scale(fenetre, orient='horizontal', variable=value_reptemps, length=350, font=("times new roman", 14), background="#2FB5A3", activebackground="#59C38D", borderwidth=0, troughcolor="white")

            var_reptemps = StringVar()
            temps = Radiobutton(fenetre, text="durée de l'exercice", variable=var_reptemps, value="seconde", font=("times new roman", 14), background="#59C38D", borderwidth=0, activebackground="#2FB5A3", width=17)
            rep = Radiobutton(fenetre, text="nombre de repetition", variable=var_reptemps, value="repetition", font=("times new roman", 14), background="#59C38D", borderwidth=0, activebackground="#2FB5A3", width=17)

            if row[1] == 0:
                var_reptemps.set("seconde")
                value_reptemps.set(row[2])
            else:
                var_reptemps.set("repetition")
                value_reptemps.set(row[1])

            canvas.create_window(800, 200, window=reptemps)
            canvas.create_window(800, 250, window=temps)
            canvas.create_window(800, 280, window=rep)

            var_pause = IntVar()
            canvas.create_text(300, 250, text="choisissez le temps de pause après l'exercice :", font=("times new roman", 16))
            pause = Scale(fenetre, orient='horizontal', variable=var_pause, length=350, font=("times new roman", 14), background="#2FB5A3", activebackground="#59C38D", borderwidth=0, troughcolor="white")
            var_pause.set(row[3])
            canvas.create_window(300, 300, window=pause)

        buttonprecedent = Button(fenetre, text="Precedent", command=lambda: requete(db, var_nomprogramme, nomprogramme, var_nomex, value_reptemps, var_reptemps, var_pause, ligne, "precedent", fenetre, canvas), font=("times new roman", 14), background="#59C38D", borderwidth=0, activebackground="#2FB5A3", width=10)
        canvas.create_window(200, 50, window=buttonprecedent)

        buttonsuivant = Button(fenetre, text="Suivant", command=lambda: requete(db, var_nomprogramme, nomprogramme, var_nomex, value_reptemps, var_reptemps, var_pause, ligne, "suivant", fenetre, canvas), font=("times new roman", 14), background="#59C38D", borderwidth=0, activebackground="#2FB5A3", width=10)
        canvas.create_window(900, 50, window=buttonsuivant)

        buttonajoutprecedent = Button(fenetre, text="ajouter un exercice avant celui-ci", command=lambda: ajout(db, var_nomprogramme, ligne, "precedent", fenetre, canvas), font=("times new roman", 14), background="#59C38D", borderwidth=0, activebackground="#2FB5A3", width=30)
        canvas.create_window(300, 450, window=buttonajoutprecedent)

        buttonajoutsuivant = Button(fenetre, text="ajouter un exercice après celui-ci", command=lambda: ajout(db, var_nomprogramme, ligne, "suivant", fenetre, canvas), font=("times new roman", 14), background="#59C38D", borderwidth=0, activebackground="#2FB5A3", width=30)
        canvas.create_window(800, 450, window=buttonajoutsuivant)

        buttonsuppr = Button(fenetre, text="supprimer cet exercice du programme", command=lambda: supprimer(db, var_nomprogramme, ligne, fenetre, canvas), font=("times new roman", 14), background="#59C38D", borderwidth=0, activebackground="#2FB5A3", width=30)
        canvas.create_window(550, 400, window=buttonsuppr)

        buttonplaceprecedent = Button(fenetre, text="placer cet exercice avant", command=lambda: placement(db, var_nomprogramme, ligne, "avant", fenetre, canvas), font=("times new roman", 14), background="#59C38D", borderwidth=0, activebackground="#2FB5A3", width=30)
        canvas.create_window(300, 500, window=buttonplaceprecedent)

        buttonplacesuivant = Button(fenetre, text="placer cet exercice après", command=lambda: placement(db, var_nomprogramme, ligne, "après", fenetre, canvas), font=("times new roman", 14), background="#59C38D", borderwidth=0, activebackground="#2FB5A3", width=30)
        canvas.create_window(800, 500, window=buttonplacesuivant)

        buttonhome = Button(fenetre, text="Terminer", command=lambda: [requete(db, var_nomprogramme, nomprogramme, var_nomex, value_reptemps, var_reptemps, var_pause, ligne, "accueil", fenetre, canvas)], font=("times new roman", 14), background="#59C38D", borderwidth=0, activebackground="#2FB5A3")
        canvas.create_window(550, 475, window=buttonhome)

    menu.menu_footer(fenetre, canvas, db)