You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
570 B
20 lines
570 B
# pip install geogebra-ggb-api-python
|
|
|
|
from pygeogebra import GeoGebra
|
|
|
|
# 创建实例
|
|
ggb = GeoGebra()
|
|
|
|
# 绘制点、线、圆
|
|
point_A = ggb.add_point("A", (0, 0))
|
|
point_B = ggb.add_point("B", (2, 1))
|
|
line_AB = ggb.add_line("AB", point_A, point_B)
|
|
circle = ggb.add_circle("Circle", point_A, 3)
|
|
|
|
# 添加动态滑块
|
|
slider = ggb.add_slider("k", 0, 5, 1)
|
|
dynamic_point = ggb.add_point("P", (slider, slider**2)) # 抛物线上的点
|
|
|
|
# 导出为HTML或PNG
|
|
ggb.export("figure.html") # 交互式网页
|
|
ggb.export("figure.png", dpi=300) # 静态图片 |