Update Element with Thread
See original GitHub issueI’ve this little examples that does not work… It’ doesn’t update the screen until I press a key.
Basically what I want is to run a thread that updates some element and update the screen Can you help me to understand why it is not completely working?
#!/usr/bin/env python3
import py_cui
import threading
import time
from datetime import datetime
class App:
def __init__(self, master):
self.master = master
self.g1 = self.master.add_scroll_menu('PANEL',
0, 0, row_span=6, column_span=6)
thread = threading.Thread(target=self.thread_update, args=())
thread.daemon = True
thread.start()
def thread_update(self):
try:
while True:
d = "TIME:{}".format(datetime.now().strftime('%X'))
self.g1.add_item(d)
time.sleep(1)
except Exception as e:
print(e)
root = py_cui.PyCUI(9,6)
root.toggle_unicode_borders()
root.set_title('Test')
s = App(root)
root.start()
Is it a thread/curses limitation?
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
How to update a value of a variable in Thread class on some ...
The main thread should add() an element to the queue (e.g. the amount ... I want to update the variable countOfAdd //of the...
Read more >Updating a UI Element from Multiple Threads - CodeProject
This article shows how to update a ToolStripProgressBar while multiple threads are running, and to stop updating it when all the threads are ......
Read more >C# Quick Tip - Update UI Elements via Separate Thread
In this quick tip, we take a look at how to update a UI element from another thread using c# delegates.
Read more >C# Update A GUI Element From Another Thread - C# Examples
This examples shows how to update a user interface element from another thread. To do this, we must update to the user interface...
Read more >Solved Two threads update the integer array Buff[] first - Chegg
Each element in Buff[] is either processed by thread 1 (added 10) or by thread 2 (subtracted 10). For example, Buff[12] = 22...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, for sure some of the documentation (like for this) needs to be overhauled eventually, I’ve just been busy with work lately, hopefully I have some extra free time in the coming months to dedicate to this.
Great! The new version will be uploaded on PyPi in the next few weeks with the fixes.