Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Run Python GUI and file parser simultaneously

$
0
0

I am currently working on a project, that consists of two scripts. One of them continuously reads out a (JSON) file (that sometimes changes) with an endless loop (while True:) and logs changes that are made to this file to another JSON file.The second script creates a GUI (using PyQt5), that should (alongside other things) show data, that the first script wrote into the JSON file.

I tried importing and calling the GUI-Script into the parser script. That didn't work, as the program starts the GUI, then I can use it, but only progresses to parse the file when the GUI is closed.The second thing I tried was the threading module, which had the exact same result: GUI starts, parsing only starts when the GUI is quit.

What other options do I have?

This is how I tried to use threading:

import threadingthread1 = threading.Thread(target=gui.startUI(), args=("Thread-Gui",))thread1.start()thread2 = threading.Thread(target=grabber.startGrabber(), args=("Thread-Grabber",))thread2.start()

Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>