添加减去并重置为数字和日期

时间:2014-07-06 23:50:02

标签: date input

我是python的新手,我想知道如何从显示数字中添加或减去1以及除了仅使用变量将数字加在一起之外我还没有找到更多的日期,但我似乎无法找到如何做一个可以通过点击按钮操作的显示器..如果这是有道理的?这是我提出的任何帮助将不胜感激

turtle.pencolor("black")
today = datetime.date.today()
difference1 = datetime.timedelta(days=-1)
company = today
site = today
writeTexts (site ,500,-215)
writeTexts (company ,-150,-215)
writeTexts (today ,500,-310)
turtle.pencolor("orange")
startValue= 0000
companyDay = startValue
siteDay = startValue
writeTexts (companyDay, -350,50)
writeTexts (siteDay, 300, 50)

GPIO.setmode(GPIO.BCM)
GPIO.Setup (17, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
GPIO.Setup (18, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
GPIO.Setup (21, GPIO.IN, Pull_up_down = GPIO.PUD_DOWN)
GPIO.Setup (22, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
GPIO.setup (23, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
GPIO.Setup (24, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
while True:
    try:
        if(GPIO.input(17)== 1): #alstom increment
            companyDay +1
            company +difference1
        if(GPIO.input(18)== 1): #alstom decrement
            companyDay -1
            company -difference1
        if(GPIO.input(21)== 1): #alstom reset
            writeTexts(companyDate ,-350,50)
            writeTexts(company ,-150,-215
        if(GPIO.Input(22)==1):  #site increment
            siteDay +1
            site +difference1
        if(GPIO.input(23)== 1):  #site decrement
            siteDay -1
            site -difference1
        if(GPIO.input(24)==1):  #site reset
            writeTexts(siteDay ,300,50)
            writeTexts(site ,500,-215)
            sleep(.01)
    except KeyboardInterrupt:
        exit()
GPIO.Cleanup ()

0 个答案:

没有答案