检查此代码 首先断开设备时,我无法收到警告框。
>if __name__ == '__main__':
old_count = new_count = seek()
startCounter = gracePeriod
有没有新的主机?
while (1):
while (new_count <= old_count) or startCounter >= 0:
startCounter -= 1
time.sleep(1) # increase to slow down the speed
old_count = new_count
new_count = seek()
pymsgbox.alert(" 'Host : %s (%s)' % (host, nm[host].hostname())", 'security alert!')
old_count = new_count =seek()
while (old_count <= new_count) or startCounter >= 0:
startCounter -=1
time.sleep(1)
old_count = new_count
new_count =seek()
pymsgbox.alert('A Device disconnected from the network',security alert')
old_count = new_count =seek()
beep()