logo

帧缓冲区画图,显示文字问题

2023-05-21 05:54
4
山东

需要离线,监控几个动态数据。

用函数img.draw_string()好像只能写字符串到帧缓冲区,那如何在帧缓冲区显示一个动态的变量。

image
2023-05-22 19:55
I
网红小智智 星瞳科技

把数字转成字符串就行了

img.draw_string(10, 10, str(12), corlor=(255,0,0) )

2023-05-27 05:14
4
山东

不是要写一个固定的数字,是写一个变量,数字是随时动态变化的。

2023-05-29 18:29
I
网红小智智 星瞳科技

变量一样可以转成字符串。


import sensor, image, time

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)

clock = time.clock()

while(True):
    clock.tick()
    img = sensor.snapshot()
    a = clock.fps()
    img.draw_string(10,10,str(a),scale=2)
2023-05-30 10:01
4
山东

受用 谢谢大师!