I have this function and with this function I want to change my 2 last values from adaptive threshold 11 and 15 with a Scale
widget. I want to use the Scale
from tkinter. I already have the function for the slider but I don't know how to connect it to my image editing function.
from tkinter import *
import cv2
def button_action():
img = cv2.imread("img.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
edges = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_MEAN_C,
cv2.THRESH_BINARY, 11, 15)
cv2.imshow("cartoon", edges)
cv2.waitKey(0)
cv2.destroyAllWindows()
def show_values():
print (w1.get(), w2.get())
master = Tk()
w1 = Scale(master, from_=0, to=42)
w1.set(19)
w1.pack()
w2 = Scale(master, from_=0, to=200, orient=HORIZONTAL)
w2.set(23)
w2.pack()
change_button5 = Button(master, text="gray", command=button_action)
change_button5.pack()
mainloop()
question from:
https://stackoverflow.com/questions/65857347/how-can-i-set-my-values-with-the-scale-widget 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…