Python绘图库EasyGraphics简介
Easygraphics 是一个模仿Borland Graphics Interface(BGI)的python绘图库。
Borland Graphics Interface ,或者 Turbo C Graphics ,是上世纪八九十年代Borland公司出品的Turbo C/Turbo C++/Borland C++等C语言产品中自带的绘图库。因为其简单易用而广受欢迎。
因为它简单易学,因此非常适合初学者用于学习编程、计算机作图和游戏制作。
下面这段代码展示了如何使用easygraphics制作出一个椭圆在窗口不断移动的动画。
from easygraphics import *
def mainloop():
x = 0;
set_color(Color.BLUE);
set_fill_color(Color.GREEN);
while is_run():
x = ( x + 1 ) % 440;
clear_device();
draw_ellipse(x + 100, 200, 100, 100);
delay_fps(60)
init_graph(640, 480)
mainloop()
close_graph()