factor = x - here
x0 = y/factor
y0 = z/factor
r0 = r/factor复制代码
root = Tk() #创建窗口
canvas = Canvas(root,width=win.width,height=win.height) #在窗口上创建画布
canvas.pack() #摆上画布
im = Image.open('filename.png') #开启图檔
photo = ImageTk.PhotoImage(image=im) #转成PhotoImage物件
Id = canvas.create_image(x, y, image=photo) #放到画布(x,y)位置
#Id则做之后面要做任何动做的依据
canvas.coords(Id, x, y) #移动位置复制代码
canvas.create_oval(x0, y0, x1, y1, fill=color) # 画(椭)圆在画布上
canvas.coords(Id, x0, y0, x1, y1) # 更动位置
# 显示及消失: 基本上以canvas.create_image及canvas.create_oval来显示,
# 以canvas.delete(Id)来删除.复制代码
def function():
pass # do somthing here
root.after(time, function)
root.after(time, function)复制代码
overlap = canvas.find_overlapping(x0, y0, x1, y1) # 找到对象列表
overlap[index] in canvas.find_withtag(tag) # 确认带有该标签tag的对象复制代码
font = ImageFont.truetype("filename.ttf", font_size) # 创建字型及其大小
im = Image.new('RGBA', (width, height)) # 创建含有alpha层的空图像
im.putalpha(0) # 设置alpha层的内容都为0(透明)
draw = ImageDraw.Draw(im) #改成ImageDraw物件
draw.text((x,y), text, fill=color, font=font) # 画上文字
image = ImageTk.PhotoImage(im) # 转成PhotoImage物件
Id = canvas.create_image(x, y, image= image) # 放到画布(x,y)位置复制代码
交流群:887934385 须要源代码请加群获取,免费提供python