我很失望,因为这完全是愚蠢的,不知道为什么它不能工作。
我有:
我有:
import random as rand
import time
import tkinter
root = tkinter.Tk()
canvas = tkinter.Canvas(root, height = 800, width = 1300)
canvas.grid(row = 0, column = 0)
root.title('Test')
root.update_idletasks()
root.update()
bench1Xadd = 0
bench1Yadd = 0
vCard1 = tkinter.PhotoImage(file = 'card1.gif')
b1Card1 = canvas.create_image(50, 500, anchor = 'nw', image = vCard1)
root.update()
time.sleep(0.03)
canvas.delete("all")
root.update()
input('')
def imageAdd(vCard, slot, x, y):
slot = canvas.create_image(x, y, anchor = 'nw', image = vCard)
return slot
imageAdd(vCard1, b1Card1, 50 + bench1Xadd, 500 - bench1Yadd)
root.update()
input('')
canvas.delete(b1Card1)
root.update()
为什么 canvas.delete()
不起作用?
如果我漏掉了任何具体细节,我很抱歉。