0

background window Image not showing in python tkinter, the vscode run without issue, what is the issue in this code?

from tkinter import *
from tkinter import ttk
import webbrowser
from PIL import Image, ImageTk
import os.path
import random

class PortableDB:
    # create window
    def __init__(self, main) :
        self.main = main
        self.main.geometry('800x500+100+100')
        self.main.resizable(False, False)
        self.main.title('Main')
    # Image Background   
        canvas = Canvas(self.main, width = 660, height = 500)  
        canvas.place(x=120,y=0)  
        img = ImageTk.PhotoImage(Image.open("C:\\Users\\ra8da\\Desktop\\11.jpg"))  
        canvas.create_image(20, 20, anchor=NW, image=img) 

main = Tk()
ob = PortableDB(main)
main.mainloop()          

0 Answers0