python 画箭头图 如何用python 画格点上的箭头图,就是有一个xy平面上的20乘

2025-03-18 22:05:25
推荐回答(1个)
回答1:

你用的graphics模块?这不是内置的,虽然它是调用内置的Tkinter画图。

option可以是"first","last","both"或"none"。见graphics.py:

def setArrow(self, option):
if not option in ["first","last","both","none"]:
raise GraphicsError(BAD_OPTION)
self._reconfig("arrow", option)

细节要查Tk文档:

6.6. The canvas line object
In general, a line can consist of any number of segments connected end to end, and each segment can be straight or curved. To create a canvas line object on a canvas C, use:
id = C.create_line ( x0, y0, x1, y1, , xn, yn, option, )
The line goes through the series of points
(x0,
y0),
(x1,
y1),

(xn,
yn).
Options include:
arrow The default is for the line to have no arrowheads. Use
arrow=FIRST to get an arrowhead at the(x0,y0)end of the line. Use
arrow=LAST to get an arrowhead at the far end. Use
arrow=BOTH for arrowheads at both ends.