def text0(screen): # 底色 pygame.draw.rect(screen, BG, (650, 2, 350, 640)) # 绘制横线 pygame.draw.aaline(screen, GREEN, (662, 50), (980, 50), 1) # 绘制信息矩形框 pygame.draw.rect(screen, GREEN, (650, 350, 342, 85), 1) # 使用系统字体 xtfont = pygame.font.SysFont('SimHei', 15) # 重新开始按钮 textstart = xtfont.render('信息', True, GREEN) # 获取文字图像位置 text_rect = textstart.get_rect() # 设置文字图像中心点 text_rect.centerx = 675 text_rect.centery = 365 # 绘制内容 screen.blit(textstart, text_rect) cars = pi_table[['carnumber', 'date', 'state']].values if len(cars) > 0: longcar = cars[0][0] cartime = cars[0][1] # 使用系统字体 xtfont = pygame.font.SysFont('SimHei', 15) # 转换当前时间 2018-12-11 16:18 localtime = time.strftime('%Y-%m-%d %H:%M', time.localtime()) htime = timeutil.DtCalc(cartime, localtime) # 重新开始按钮 textscar = xtfont.render('停车时间最长车辆:' + str(longcar), True, RED) texttime = xtfont.render("已停车:" + str(htime) + '小时', True, RED) # 获取文字图像位置 text_rect1 = textscar.get_rect() text_rect2 = texttime.get_rect() # 设置文字图像中心点 text_rect1.centerx = 820 text_rect1.centery = 320 text_rect2.centerx = 820 text_rect2.centery = 335 # 绘制内容 screen.blit(textscar, text_rect1) screen.blit(texttime, text_rect2) pass
carsk = pi_table['carnumber'].values # 判断当前识别得车是否为停车场车辆 if carnumber in carsk: txt1 = '车牌号: ' + carnumber # 时间差 y = 0 # 获取行数用 kcar = 0 # 获取文档内容 cars = pi_table[['carnumber', 'date', 'state']].values # 循环数据 for car in cars: # 判断当前车辆根据当前车辆获取时间 if carnumber == car[0]: # 计算时间差 0,1,2... y = timeutil.DtCalc(car[1], localtime) break #行数+1 kcar = kcar + 1 #判断停车时间 如果时间 if y == 0: y = 1 txt2 = '停车费:' + str(3 * y) + '元' txt3 = '出停车场时间:' + localtime # 删除停车场车辆表信息 pi_table = pi_table.drop([kcar], axis=0) # 更新停车场信息 pi_info_table = pi_info_table.append( { 'carnumber': carnumber, 'date': localtime,