Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing code only if the gui is open #217

Open
Czar1249 opened this issue Jan 12, 2023 · 0 comments
Open

Executing code only if the gui is open #217

Czar1249 opened this issue Jan 12, 2023 · 0 comments

Comments

@Czar1249
Copy link

I'm trying to make a basic script that could open a dataframe in the gui and then update this dataframe every 'x' seconds. However, my best attempt just results in the show() command being executed infinitely with no delay until I kill the script. Here's an example:

updateTimer = 5 
if __name__ == '__main__':
    gui = show(df, settings = {'block': False})

    trackTime = time.time()

    while gui:
        if (time.time() - trackTime >= updateTimer):
            df = pymongo.DataFrame(RedBoard.find())
            df = df[df['Date_Time'].notnull()]
            gui.store.remove_dataframe('df')
            gui.store.add_dataframe(df, 'df')

is there something in the library that would allow me to directly check if the window is open? If not, what would be my best course of action to only execute the code in the while loop when the gui is open?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant