import tkinter as tk
from tkinter import ttk

root = tk.Tk()

options = ['Option 1', 'Option 2', 'Option 3']
variable = tk.StringVar(value=options[0])

def on_option_changed(*args):
    print('helloworld')
    # This function will be called whenever the selected option changes
    # We will use it to update the option list based on the selected option

    # Get the selected option
    selected_option = variable.get()

    # Update the option list based on the selected option
    if selected_option == 'Option 1':
        new_options = ['Option 1', 'Option 2', 'Option 3']
    elif selected_option == 'Option 2':
        new_options = ['Option 4', 'Option 5', 'Option 6']
    else:
        new_options = ['Option 7', 'Option 8', 'Option 9']

    # Update the option list in the widget
    combobox.configure(values=new_options)

# Create the widget
combobox = ttk.Combobox(root, textvariable=variable, values=options)
combobox.pack()

# Bind the on_option_changed function to the variable
variable.trace('w', on_option_changed)

root.mainloop()
