from dearpygui.core import * from dearpygui.simple import * add_additional_font("潦草丫丫字体.ttf", size=30, glyph_ranges="chinese_full") def Render(sender, data): # 得到帧的时间 steps = get_data("steps") step_speed = get_data("step_speed") steps_RLTD = get_data("steps_RLTD") delta_draw_time = get_data("delta_draw_time") draw_speed = get_value("Draw_Speed") if delta_draw_time > draw_speed: # 这里添加一个鼠标事件控制方向 if is_key_down(mvKey_Right): add_data("steps_RLTD", 0) print("向右") elif is_key_down(mvKey_Left): add_data("steps_RLTD", 1)