I have a window application in which I am trying to refresh a table every x seconds after running my function. However I could not find any suitable method to rerun the function within the event loop of the app. This is my code and the function I'm trying to rerun is FLAS(I'm returning a list of objects).
flights = FLAS()
with dpg.window(width=785, height=600, no_collapse=True, no_move=True, no_title_bar=True, no_resize=True):
with dpg.table(header_row=True, policy=dpg.mvTable_SizingFixedFit, row_background=True, reorderable=True,
resizable=False, no_host_extendX=False, hideable=True,
borders_innerV=True, delay_search=True, borders_outerV=True, borders_innerH=True,
borders_outerH=True):
dpg.add_table_column(label="Callsign", width_fixed=True)
dpg.add_table_column(label="FIX", width_fixed=True)
dpg.add_table_column(label="Exit FIR", width_fixed=True)
dpg.add_table_column(label="Next FIR", width_fixed=True)
dpg.add_table_column(label="Entry FL", width_fixed=True)
dpg.add_table_column(label="Exit FL", width_fixed=True)
print(len(flights))
if len(flights) == 0:
flights.append(Flight("No flights in range", 000000, "XXX", 0, "XXXX", "XXXX",0,0,0,0))
for flight in flights:
with dpg.table_row():
dpg.add_text(flight.callsign)
dpg.add_text(flight.fix)
dpg.add_text(flight.cFIR)
dpg.add_text(flight.xFIR)
dpg.add_text(flight.efl)
dpg.add_text(flight.xfl)
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()