#this is '_uiPPP_' file #rembere to rename the other file '_printJsonName_' to make it work import json import os import re from ipywidgets import widgets from IPython.display import display #from tkinter import * import tkinter as tk import _printJsonName_ grab_the_json = _printJsonName_.returnJsonNames() printThemasterModelsNames_ = 0 printThemasterModelsDic_ = 0 #options = ['option1', 'option2', 'option3'] #use names from the 'key' valable from the main dictionary #than use it as the loop to grab them into index list and #pass it along as a dropdown list options = [key for key in grab_the_json] def on_select(v): print(v) print(options.index(v)) def offlineMode(): root = tk.Tk() root.geometry('400x200') #entry1 = tk.Entry(root, width = 30) #entry1.pack() #def button_command(): # text = entry1.get() # print(text) # #print("test") # return None #tk.Button(root, text="Button", command=button_command).pack() #drop down var = tk.StringVar(value='option1') #options = ['option1', 'option2', 'option3'] dropdown = tk.OptionMenu(root, var, *options, command=on_select) dropdown.pack() ###elements go above root.mainloop() def onlineMode(): zxcv = 'yes' # check if the COLAB_ENV variable is present # this variable is set by default in Colab if 'COLAB_ENV' in os.environ: print('This code is running in Colab') onlineMode() else: print('This code is running in offline Python') offlineMode() #########Testing out grabing function has worked########################## ####call out loop by the first layer names inside of the nested dictionary def printThemasterModelsNames(): for masterModelsNames in grab_the_json.keys(): print(masterModelsNames) ####print everything inside the masterModelsDictionary def printThemasterModelsDic(): print(grab_the_json) if (printThemasterModelsNames_): printThemasterModelsNames() if (printThemasterModelsDic_): printThemasterModelsDic() #print(grab_the_json)