Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python tkinter画布几何体_Tkinter - Fatal编程技术网

Python tkinter画布几何体

Python tkinter画布几何体,tkinter,Tkinter,请帮我做第三个椭圆形圆。。。我从一小时开始改变价值观,但没有运气:(( 通过调整坐标,可以使椭圆形变成圆形 椭圆由矩形坐标定义 画布。创建椭圆(x0,y0,x1,y1,…) x0和y0是矩形的左上角 x1和y1是矩形的右下角 你的问题是简单的数学(加减法) 你说“做我的第三个椭圆”是什么意思?第三,像第一个和第二个一样,请看附图而不是椭圆你想要一个圆吗?是的,精确的圆,但第一个和第二个不是圆,它们是椭圆的 import tkinter as tk root = Tk() canva

请帮我做第三个椭圆形圆。。。我从一小时开始改变价值观,但没有运气:((


通过调整坐标,可以使椭圆形变成圆形

椭圆由矩形坐标定义

画布。创建椭圆(x0,y0,x1,y1,…)

x0和y0是矩形的左上角

x1和y1是矩形的右下角

你的问题是简单的数学(加减法)


你说“做我的第三个椭圆”是什么意思?第三,像第一个和第二个一样,请看附图而不是椭圆你想要一个圆吗?是的,精确的圆,但第一个和第二个不是圆,它们是椭圆的
import tkinter as tk



root = Tk()



canvas = tk.Canvas(root, width=52, height=160)
canvas.place(x=0, y=10)

oval_red = canvas.create_oval(10, 5, 50, 50, fill="white")
oval_yellow = canvas.create_oval(10, 100, 50, 55, fill="white")
oval_green = canvas.create_oval(10, 205, 60, 100, fill="white")


canvas.itemconfig(oval_red, fill="red")
root.mainloop()


  [1]: https://i.stack.imgur.com/u5xHM.png
from tkinter import Tk, Canvas

root = Tk()
canvas = Canvas(root, width=400, height=400)
canvas.place(x=0, y=10)

oval_red = canvas.create_oval(10, 5, 50, 50, fill="white")      #this is an ellipse
oval_yellow = canvas.create_oval(10, 100, 50, 55, fill="white") #this is an ellipse
oval_green = canvas.create_oval(10, 110, 60, 160, fill="white") #this is a circle
canvas.itemconfig(oval_red, fill="red")

root.mainloop()