资源简介
个人编写的小程序,实现拓片在GUI的拖动,十分盈动好用
代码片段和文件信息
import tkinter
import time
app = tkinter.Tk()
app[‘width‘] = 1000
app[‘height‘] = 6000
canvas = tkinter.Canvas(appbg=‘white‘width=1000height=6000)
image=tkinter.PhotoImage(file=‘C:/Users/穆尼/Desktop/python/python/tim.gif‘)
id_actor=canvas.create_image(8080image=image)
flag=False
def onLeftButtonDown(event):
global flag
flag=True
while flag:
canvas.move(id_actor50)
canvas.update()
time.sleep(0.05)
canvas.bind(‘‘onLeftButtonDown)
def onRightButtonUp(event):
global flag
flag=False
canvas.bind(‘‘onRightButtonUp)
def keyControl(event):
if event.
评论
共有 条评论