wait

Is tkwait wait_variable/wait_window/wait_visibility broken?

Is tkwait wait_variable/wait_window/wait_visibility broken? Question: I recently started to use tkwait casually and noticed that some functionality only works under special conditions. For example: import tkinter as tk def w(seconds): dummy = tk.Toplevel(root) dummy.title(seconds) dummy.after(seconds*1000, lambda x=dummy: x.destroy()) dummy.wait_window(dummy) print(seconds) root = tk.Tk() for i in [5,2,10]: w(i) root.mainloop() The code above works just fine …

Total answers: 1

Wait for the first subprocess to finish

Wait for the first subprocess to finish Question: I have a list of subprocess‘ processes. I do not communicate with them and just wait. I want to wait for the first process to finish (this solution works): import subprocess a = subprocess.Popen([‘…’]) b = subprocess.Popen([‘…’]) # wait for the first process to finish while True: …

Total answers: 5

ElasticSearch updates are not immediate, how do you wait for ElasticSearch to finish updating it's index?

ElasticSearch updates are not immediate, how do you wait for ElasticSearch to finish updating it's index? Question: I’m attempting to improve performance on a suite that tests against ElasticSearch. The tests take a long time because Elasticsearch does not update it’s indexes immediately after updating. For instance, the following code runs without raising an assertion …

Total answers: 5

Python, sleep some code not all

Python, sleep some code not all Question: I have a situation, where at some point in my code I want to trigger a number of timers, the code will keep running, but at some point these functions will trigger and remove an item from a given list. Similar though not exactly like the code below. …

Total answers: 3

Python subprocess Popen.communicate() equivalent to Popen.stdout.read()?

Python subprocess Popen.communicate() equivalent to Popen.stdout.read()? Question: Very specific question (I hope): What are the differences between the following three codes? (I expect it to be only that the first does not wait for the child process to be finished, while the second and third ones do. But I need to be sure this is …

Total answers: 1

Python popen command. Wait until the command is finished

Python popen command. Wait until the command is finished Question: I have a script where I launch with popen a shell command. The problem is that the script doesn’t wait until that popen command is finished and go continues right away. om_points = os.popen(command, “w”) ….. How can I tell to my Python script to …

Total answers: 7

How do I wait for a pressed key?

How do I wait for a pressed key? Question: How do I make my python script wait until the user presses any key? Asked By: Janusz || Source Answers: In Python 3, use input(): input("Press Enter to continue…") In Python 2, use raw_input(): raw_input("Press Enter to continue…") Answered By: Greg Hewgill In Python 3, use …

Total answers: 13