I have an application wherein, I have to pop a Spinbox
widget on click of a button. The widget needs to be overlayed on a background which is an image. I have tried with the code below, but the widget does not appear on the click of the button. I believe the image display is taking precedence over the widget display.
import tkinter as tk
import cv2
from PIL import Image,ImageTk
top = tk.Tk()
count = 1
image = cv2.imread("frames/0.jpg")
w = tk.Spinbox(top, from_=0, to=10)
def helloCallBack():
global count,w
if count%2 != 0:
w.pack()
else:
w.forget()
print(count)
count+=1
B = tk.Button(top, text ="Hello", command = helloCallBack)
B.pack()
label = tk.Label(top)
label.pack()
img = Image.fromarray(image)
imgtk = ImageTk.PhotoImage(image=img)
label.imgtk = imgtk
label.configure(image=imgtk)
top.update()
top.mainloop()