我有 Tkinter 窗口,canvas
上面label
有 200x200 图片。我想label
在窗口的中心,不管窗口大小。
from Tkinter import *
import Image, ImageTk, ImageDraw
imgsize = (200,200)
canvas_bg = "#000000"
root = Tk()
## root.geometry("350x350")
panel = PanedWindow()
panel.pack(expand=0)
canvas = Canvas(panel, bg=canvas_bg)
blank_source = Image.new('RGBA',imgsize, "#ffffff")
blank = ImageTk.PhotoImage(blank_source)
label = Label(canvas, image=blank)
label.configure(image = blank)
canvas.pack( expand=0)
mainloop()
有什么办法吗?