python 3.x - Set a background image for my window -
i wondering should apply image background of tkinter window. want window gif image in background , few buttons on top of it..
the error msg says: "x.image = bg_image.grid(row = 0, column = 0) attributeerror: 'photoimage' object has no attribute 'grid'"
do need import else? whats wrong? dont know if photoimage code supported version of python (python 3.1.1)...
from tkinter import* window = tk() window.title("ksdasndsnadn") bg_image = photoimage(file ="pic.gif") x = label (image = bg_image) x.image = bg_image.grid(row = 0, column = 0) window.geometry("600x300") app = application(window) window.mainloop()
you need apply grid
method label contains image, not image object:
bg_image = photoimage(file ="pic.gif") x = label (image = bg_image) x.grid(row = 0, column = 0)
Comments
Post a Comment