2 飛ぶとif my_count_tim >= timer0_interval_hafe and bol_set_time0 == (0):をやってくれない。
import math
import datetime
import msvcrt
timer0_timup_bol = bool(0)
timer0_interval_in=2000
timer0_interval = 300
timer0_interval_hafe=150
if timer0_interval_in>300:
timer0_interval = timer0_interval_in
timer0_interval_hafe = int(math.floor(timer0_interval / 2))
if timer0_interval_hafe < 250:
display = ""
bol_stato_tim = bool(0)
bol_hafe_time0 = bool(0)
count=0
my_over_bol = bool(0)
bol_set_time0 =bool(0)
my_count_tim =0
now_str = datetime.datetime.now()
formatted_now = now_str.strftime("%Y-%m-%d %H:%M:%S.%f")
arrey_time_now = formatted_now.split(":")
new_tim0_now=int(float(arrey_time_now[2])*1000)
while True:
now_str = datetime.datetime.now()
formatted_now = now_str.strftime("%Y-%m-%d %H:%M:%S.%f")
# print(formatted_now
#2024-01-12 15:32:11.123456
arrey_time_now = formatted_now.split(":")
time0_now_sec=int(float(arrey_time_now[2])*1000)
if time0_now_sec<new_tim0_now:
print("1minit a goo",time0_now_sec,"<",new_tim0_now)
ima_time = time0_now_sec
if new_tim0_now != time0_now_sec:
test_ti= 0
if time0_now_sec-new_tim0_now < 0:
test_ti = (60000 + time0_now_sec)-new_tim0_now
my_count_tim0 = 60000+time0_now_sec-new_tim0_now
else:
test_ti = time0_now_sec-new_tim0_now
my_count_tim0 = time0_now_sec-new_tim0_now
if test_ti != 1:
print("1minit a goo test not 1 ",test_ti,":",ima_time,"<",new_tim0_now)
my_count_tim0 = 0
new_tim0_now = time0_now_sec
my_count_tim +=1
if my_count_tim >= timer0_interval_hafe and bol_set_time0 == (0):
bol_set_time0 =bool(1)
bol_hafe_time0 = bool(1)
if timer0_interval_hafe >=250:
display = "□"
# now_str0 = datetime.datetime.now()
print (display)
# print (my_count_tim,":",timer0_interval_hafe,"@",now_str0.strftime("%Y-%m-%d %H:%M:%S.%f"))
# print("\n")
#elif my_sectr_tim % timer0_interval <= timer0_interval_hafe and bol_set_time0 == (1):
elif my_count_tim >= timer0_interval and bol_set_time0 == (1):
bol_set_time0 = bool(0)
if timer0_interval_hafe >=250:
display = "■"
# now_str1 = datetime.datetime.now()
print (display)
# print (my_count_tim,":",timer0_interval_hafe,"@",now_str1.strftime("%Y-%m-%d %H:%M:%S.%f"))
# print("\n")
# bol_hafe_time0 = bool(0) #time up after cller
if my_count_tim<0:
my_count_tim = 0
bol_set_time0 = bool(0)
bol_hafe_time0 = bool(0)
print("bad count")
if my_count_tim >= timer0_interval and bol_hafe_time0 ==(1):
bol_set_time0 = bool(0)
timer0_timup_bol = bool(1)
my_count_tim = 0
bol_hafe_time0 = bool(0)
#it cller
#s = msvcrt.getch().decode('utf-8')
if count >100 and timer0_timup_bol ==(1):
print ("Geme Over\n")
my_over_bol = bool(1)
elif timer0_timup_bol ==(1):
count +=1
timer0_timup_bol = bool(0)
print (int(count))
if my_over_bol==(1):
break
elif msvcrt.kbhit():
x = msvcrt.getch().decode('utf-8')
print(f"Received input: {x}")
break
exit()