I have two threads going
class guiThread(threading.Thread)
class mainThread(threading.Thread)
Within the guiThread, I have an instance of class GUIFramework(Frame)
in this Tkinter instance I have a ListBox.
The second thread, mainThread, has an instance of a custom class the
will need to send out text or other objects to the gui.
What is the best or easiest way to send, let's say text, from
mainThread to the guiThread ListBox?
Should I use a custom Event class, pubsub, or Queue?
This is the way I have things right now (not in its entirety):
-----
start.py
import threading
import thread
import time
import GUIFramework
import myFoo
class guiThread(threading.Thread):
def __init__(self, threadID, name):
self.threadID = threadID
self.name = name
self.guiFrame = GUIFramework(master=None)
threading.Thread.__init__(self)
def run(self):
print "Starting " + self.name
self.guiFrame.mainloop()
print "Exiting " + self.name
class mainThread(threading.Thread):
def __init__(self, threadID, name):
self.threadID = threadID
self.name = name
self.myFoo = myFoo()
threading.Thread.__init__(self)
def run(self):
print "Starting " + self.name
self.myFoo.alive()
print "Exiting " + self.name
def start():
""" Start """
#Create new threads
threadgui = guiThread(1, "threadgui")
threadmain= carlThread(2, "threadmain")
#Start new Threads
threadgui.start()
threadmain.run()
while threadmain.isAlive():
if not threadgui.isAlive():
doExit = 1
pass
print "Exiting Main Thread"
if __name__ == '__main__':
start()
-----
I've tried a fews things but I really haven't had any luck.
--
Thanks, Joe 1 1228
In article <ma**************************************@python.o rg>,
JoeSox <jo****@gmail.comwrote:
> I have two threads going class guiThread(threading.Thread) class mainThread(threading.Thread)
Within the guiThread, I have an instance of class GUIFramework(Frame) in this Tkinter instance I have a ListBox.
The second thread, mainThread, has an instance of a custom class the will need to send out text or other objects to the gui.
What is the best or easiest way to send, let's say text, from mainThread to the guiThread ListBox?
Should I use a custom Event class, pubsub, or Queue?
Well, I'd recommend a Queue, but that's partly because I have an example
already made up: http://www.pythoncraft.com/OSCON2001/FibThreaded.py
--
Aahz (aa**@pythoncraft.com) <* http://www.pythoncraft.com/
"Typing is cheap. Thinking is expensive." --Roy Smith This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: haptiK |
last post by:
Hello,
can i use php to multithread mail() or something similar? in my company
i need to send multiple copies of email to a few hundred ppl affilated
and on my list.
instead of calling mail over and over again i would like to thread this
process.
could someone point me to some documentation or perhaps an example of
|
by: r_obert |
last post by:
Hello,
I'm trying to create a worker thread for my VC++ program, and was
wondering whether I should be linking with the Multithread /MT or
Multithread DLL /MD option? I'm not quite sure, in layman's terms,
what the difference is.
When I build with Multithread DLL, the linker complains about not
being able to find a bunch of "unresolved...
|
by: Simon Middlemiss |
last post by:
I am writting a program to manage DTS packages which is based on the code
example at the following link
http:\\www.support.microsoft.com/?kbid=319985.
I need to do things in a Windows Forms Application when various things occur
in the package so I have written some custom events to reraise the events
caught in the PackageEventsSink class.
...
|
by: Kevin Jiang |
last post by:
the injected line is this:
struct __EventingCriticalSectionStub
{
void Lock()
{
}
void Unlock()
{
}
|
by: M.C |
last post by:
Following is a snap-shot of compiler created code when using UEM, use /Fx:
struct __EventCriticalSectionStub
{
void Lock() {}
void Unlock() {}
};
....
| |
by: Ekempd |
last post by:
Hi I need some advice about this situation an how I'm current handling it
I hava a ASP.NET solution that in some point start multiples lenghty
verification agains diferent databases, my big challenge is that the user
click in a button "start process"
and close the explorer windows... and in the backgroud all the required
query are executed,...
|
by: fred |
last post by:
I need some help in trying to understand how to make myCollection (inherited
from CollectionBase) multithread safe.
Taking my implementation of the Add Sub and a readonly property Item.
Public Sub Add(ByVal aDoc As myDocument)
List.Add(aDoc)
End Sub
Can I make this multithread safe by and is this the best way to do it.
|
by: jmartin |
last post by:
Hi,
I have made a multithread version of a program (load a file into
database), and with two processors I get the double of time in the
multithread than in the process (unithread) version.
I have done the test of creating a unique thread that does the same
code that the process version of the program and it takes more time
that the...
|
by: tikcireviva |
last post by:
Hi Guys,
I've done a mulithread queue implementation on stl<queue>, my
developement environment is on VC6 as well as FC3. Let's talks about
the win32 side.
The suspected memory leak is find after I've run through my unit test
cases.
Test Case:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |