Why is Photoimage put slow?

前端 未结 3 687
伪装坚强ぢ
伪装坚强ぢ 2020-12-20 21:43

When manipulating photoimage objects, with:

import tkinter as tk

img = tk.PhotoImage(file=\"myFile.gif\")
for x in range(0,1000):
  for y in range(0,1000):
         


        
3条回答
  •  时光说笑
    2020-12-20 21:56

    Use a bounding box:

    from Tkinter import *
    root = Tk()
    label = Label(root)
    label.pack()
    img = PhotoImage(width=300,height=300)
    data = ("{red red red red blue blue blue blue}")
    img.put(data, to=(20,20,280,280))
    label.config(image=img)
    root.mainloop()
    

提交回复
热议问题