I created a window that captures the webcam by Tkinter, and I wanted to put transparent buttons in it. I joined the camera code + the one I found on the site (Transparent Backgrounds on Buttons in Tkinter), individually both work, but together I get the error "'Label' object has no attribute 'create_image'"
What could I do please?
from PIL import Image,ImageTk
import pytesseract
import cv2
import tkinter as tk
from tkinter import *
#from tkinter.ttk import *
from PIL import Image, ImageTk
#Create the window and camera
width, height = 1920,1080 #800, 600
cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, width)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height)
root = Tk()
root.geometry("1920x1080") #adc isso
#root.attributes('-alpha',0.5) deixa transpartente
root.bind('<Escape>', lambda e: root.quit())
lmain = Label(root)
lmain.pack()
def show_frame():
_, frame = cap.read()
frame = cv2.flip(frame, 1)
cv2image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
cv2image = cv2.resize(frame, (1000,700))
img = PIL.Image.fromarray(cv2image)
imgtk = ImageTk.PhotoImage(image=img)
lmain.imgtk = imgtk
lmain.configure(image=imgtk)
lmain.after(10, show_frame)
#Create the transparent buttons
def exit(event):
window.destroy()
#creating button which supports png transparency
b1Image = ImageTk.PhotoImage(Image.open("Design sem nome.gif"))
b1Button = lmain.create_image(50, 50, image=b1Image)
lmain.tag_bind(b1Button, "<Button-1>", exit)
show_frame()
root.mainloop()