下面是一些示例代码:如何让图像成为标签唯一可见的部分?
import tkinter as tk
import tkinter.ttk as ttk
root = tk.Tk()
root['background'] = 'black'
# this image here is just a placeholder. For the real application I will be using an image that is not a solid color.
image = tk.PhotoImage(width=1,height=1)
image.put(data='red', to=(0,0))
image = image.zoom(32, 32)
label = ttk.Label(root, image=image)
label.grid()
label = tk.Label(root, image=image)
label.grid(row=1,column=1)
root.mainloop()
该代码就会把图像变成Label
小部件,但对我的问题是,有图像周围的边框所看到的这个截图:
如何让图像成为标签唯一可见的部分(即,您只能看到没有边框/填充的图像)?
边界。有边界。 –