'Return multiple values to script

In the script below I import some pictures that I want to segmentate. The segmentation is done withe the line: mask = cv.inRange(blur0, low_yellow, high_yellow) As you can see, normally the low_yellow and high_yellow is given. But depending the color of the pictures, I need a different segmentation. So, I created a listbox in Tkinter with the different colors. When I select some item in the listbox, I want to make a return value who fills in the low_yellow and the high_yellow. So 2 different return values. I did already some trail and error, but couldn't find the solution. My question is, is it possible to make 2 different renturn values and hwo?

from tkinter import *
from tkinter import filedialog
import tkinter as tk
import datetime
   
import cv2 as cv
import glob
import numpy as np
import pandas as pd
from colormath.color_objects import sRGBColor, xyYColor, LabColor, XYZColor
from colormath.color_conversions import convert_color
import os

# create folder for subfolders
Foldername = 'Kleurmeting_output'
mainfolder = os.getcwd() + '\\' + Foldername

if not os.path.exists(mainfolder):
    os.makedirs(mainfolder)


def Innovator(ImagePath, SavePath, LowY, HighY):
    dfs = []
    for file in glob.glob(ImagePath):
        print(file)
        img = cv.imread(file)
        scale_percent = 60
        width = int(img.shape[1] * scale_percent / 100)
        height = int(img.shape[0] * scale_percent / 100)
        dim = (width, height)
        imgr = cv.resize(img, dim, interpolation=cv.INTER_AREA)

        hsv = cv.cvtColor(imgr, cv.COLOR_BGR2HSV)
        blur0 = cv.medianBlur(hsv, 11)

        #low_yellow = np.array([10, 42, 210])
        #high_yellow = np.array([30, 255, 255])
   
        low_yellow = LowY
        high_yellow = HighY

        print(low_yellow)
        print(high_yellow)

        mask = cv.inRange(blur0, low_yellow, high_yellow)
        res = cv.bitwise_and(imgr, imgr, mask=mask)

        fname = os.path.splitext(os.path.basename(file))[0]

        # print(fname)

        Imagefolder = str(SavePath) + '\\' + 'Gesegmenteerde afbeelding'

        if not os.path.exists(Imagefolder):
            os.makedirs(Imagefolder)

        cv.imwrite(str(SavePath) + f'/Gesegmenteerde afbeelding/{fname}.jpg', res)

        result_df = pd.DataFrame()
        #FileNames = ['Mean']

    

def run_command():
    if Most_Recent == 0:  # Geen selectie
        print("Select a folder")
    elif Most_Recent == 'Image':  # Afbeelding

        if Listb.get(ANCHOR) == '':
            print("Select the potato type")
        else:
            # Creates subfolder
            d = datetime.datetime.now()
            SaveFolder = os.getcwd() + '\\' + Foldername + '\\' + str(d.date()) + '_Change_name_later1'

    else:
        # Folder
        if Listb.get(ANCHOR) == '':
            print("Select the potato type")
        else:
            # Creates subfolder
            d = datetime.datetime.now()
            SaveFolder = os.getcwd() + '\\' + Foldername + '\\' + str(d.date()) + '_Change_name_later'
            if not os.path.exists(SaveFolder):
                os.makedirs(SaveFolder)

    #SavedImage = SaveFolder + '\\' + 'Gesegmenteerde afbeelding' + '*.jpg'
    ScriptPath = New_Method_Script_Parser((Listb.get(ANCHOR)))
    print(ScriptPath)

    Innovator(ImagePath= FolderPath, SavePath= SaveFolder, LowY=ScriptPath, HighY=ScriptPath)


def New_Method_Script_Parser(ListValue):  

    if ListValue == 'Wit':
        return LowY(10, 40, 220), High(30, 255, 255)
    elif ListValue == 'Licht geel':
        return "--LowY 10 42 210 --HighY 30 255 255"
    elif ListValue == 'Geel':
        return "--LowY 10 42 200 --HighY 30 255 255"
    elif ListValue == 'Donker geel':
        return "--LowY 10 42 190 --HighY 30 255 255"

Listb = Listbox(root)
Listb.insert(0, "Wit")
Listb.insert(1, "Licht geel")
Listb.insert(2, "Geel")
Listb.insert(3, "Donker geel")
Listb.place(x=100, y=100)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source