I'm trying to insert items to a tkinter listbox from a grib file using keywords like name or forecastTime, but I don't want the listbox to contain duplicates just one of each value. Couldn't get it to work using lists and ifs only work for specific files and I want it to be operational with any grib I attach to it. Here's the code:
from tkinter import *
import pygrib
okno = Tk()
grbs = pygrib.open('/home/michal/Desktop/ROUTING_subarea_1_wind_wave.grb2')
listaprognoza = Listbox(okno, height=8, width=50, exportselection=False)
listaprognoza.pack()
grbs.seek(0)
for grb in grbs:
listaprognoza.insert(END, grb.name)
I never tried
pygrib
Try this if it can work.