1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
from tkinter import *
from time import *
root = Tk()
root.config(bg='#41B77F')
root.geometry('450x220+912+620')
def a1():
pass
def a2():
pass
def a3():
pass
def a4():
pass
def a5():
pass
def a6():
pass
volt = 0
state = 0
def auto2():
pool=(a1, a2, a3, a4, a5, a6)
global state
global volt
if volt > 53 and volt <= 55:
if state >= len(pool):
print("(%d) - Impossible, plus de machine à allumer" % state)
else:
state+=1
print("(%d) - Allumage %s" % (state, pool[state-1]()))
(state, pool[state-1]())
elif volt < 49:
if state <= 0:
print("(%d) - Impossible, plus de machine à éteindre" % state)
else:
print("(%d) - Extinction %s" % (state, pool[state-1]()))
(state, pool[state-1]())
state-=1
else:
print("(%d) - Rien à faire..." % state)
def automatique():
if auto["bg"] == "white":
auto["bg"] = "red"
while auto["bg"] == "red":
auto2()
auto = Checkbutton(root, text="Automatique", command=automatique, bg="white")
auto.place(relx=0.5, rely=0.5, anchor=CENTER)
root.mainloop() |