I can't display text over my tkinter image I can't display text over my tkinter image tkinter tkinter

I can't display text over my tkinter image


The Label constructor takes a parameter compound. Pass the constructor both the image and text, and pass in compound as Tkinter.CENTER to overlap the text onto the image. Documentation for this feature is at http://effbot.org/tkinterbook/label.htm

import Tkinterimport Image, ImageTk# open a SPIDER image and convert to byte format    im = Image.open(r'C:\Users\JOHN\Desktop\key.jpg')root = Tkinter.Tk()  # A root window for displaying objects# Convert the Image object into a TkPhoto objecttkimage = ImageTk.PhotoImage(im)Tkinter.Label(root, image=tkimage, text="Update User", compound=Tkinter.CENTER).pack() # Put it in the display windowroot.mainloop() # Start the GUI

Also note, you're not supposed to mix pack and grid. You should choose one or the other. Reference: http://effbot.org/tkinterbook/grid.htm

P.S. just in case you meant you want the text to be vertically higher than the image, you can use the same code as above, except set compound=Tkinter.BOTTOM.