python tkinter coordinate conversion

tkinter coordinate origin in the upper left corner, the horizontal axis to the right, down the vertical axis, drawing need to convert coordinates to a point in the lower right corner to meet our common coordinate

Is set to the coordinate origin (x0, y0), the right abscissa, ordinate up:

Conversion: to achieve coordinate point (x, y) of the display

          The actual display coordinates are (x0 + x, y0-y)

 

xlinepoint=[20,500,900,500]
ylinepoint=[20,500,20,20]
xy=[20,500,20+40,500-40,20+120,500-200]



traceID = graph.create_oval(20-1,500-1,20+1,500+1,fill='black')
traceID1=   graph.create_line(xlinepoint,fill='black')
traceID1=   graph.create_line(ylinepoint,fill='black')
traceID1=   graph.create_line(xy,fill='black')

Is a program to achieve the above origin (40, 40) to move the origin of coordinates (20,500), the connection (120, 200) of the three

Guess you like

Origin www.cnblogs.com/mghhzAnne/p/10980856.html