Python Forum
Updating/running code when path changes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Updating/running code when path changes
#3
(Jul-06-2022, 01:12 PM)deanhystad Wrote: You need a periodic event. In tkinter you could use .after() to call a function.
def update_phase():
    with open('number.json', 'r') as f:
        distros_dict = json.load(f)
    for distro in distros_dict:
        op = json.dumps(distro["text"])
    str = path+op+".png"
    # Open file and update image

    # Repeat in an hour 3,600,000 milliseconds
    root.after(3600000, update_phase)

Thanks. But I now get this error:
Error:
AttributeError: type object 'str' has no attribute 'read'
I'm trying to figure out what it means.
Reply


Messages In This Thread
RE: Updating/running code when path changes - by hermannhaf - Jul-06-2022, 01:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  running the code and seeing the GUI chriswrcg 1 885 May-19-2023, 04:49 PM
Last Post: deanhystad
  [PyQt] source code is not running in REDHAT 7 linux platform shridhara 0 2,162 May-23-2018, 07:58 AM
Last Post: shridhara
  Errors while running dash plotly code Nischitha 3 5,341 Aug-24-2017, 10:54 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020