•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 391,924 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,696 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser:
Views: 258 | Replies: 3
![]() |
•
•
Join Date: Jun 2008
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 0
Hi everybody!
I wrote for my company one little test application: Frame , Pmw.NoteBook and few buttons.
and one main button 'Start' under NoteBook which starts process depend on name of Pmw.NoteBook...
everything is fine , the problem is each of the processes run ~10 min and all this time: button 'Start' is still pressed; GUI not responsable at all, so I can't go to another Tab and start another process...
I guess it multithreading issue ... Does somebody has little example to start two processes from one button?
Will be very appreciated for any suggestion.
Thanks,
Slava.
I wrote for my company one little test application: Frame , Pmw.NoteBook and few buttons.
and one main button 'Start' under NoteBook which starts process depend on name of Pmw.NoteBook...
everything is fine , the problem is each of the processes run ~10 min and all this time: button 'Start' is still pressed; GUI not responsable at all, so I can't go to another Tab and start another process...

I guess it multithreading issue ... Does somebody has little example to start two processes from one button?
Will be very appreciated for any suggestion.
Thanks,
Slava.
Last edited by splakhin : 34 Days Ago at 5:01 pm.
yes you need to make it multi-threaded. Everytime the user clicks on the button it can spawn a new thread which does the work and the button is free for input. i think this code should help you
you'll see that each thread sleeps for a minute but the input button doesn't wait for the output and is ready to take the next input. Once each thread finishes it prints the 'bye' message.
I'm fairly new to multi-threading myself so if you find any issues with this let me know or any doubts.
python Syntax (Toggle Plain Text)
from Tkinter import * import threading import time class process(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): print 'hello' time.sleep(60) print 'bye' #The class process derives from threading.Thread. whenver we say process.start it spawns #a new thread and calls it's 'run' method def startThread(): process().start() root = Tk() frame = Frame(root) frame.pack() #when user clicks button it calls 'startThread' command but = Button(frame,text='start',command=startThread) but.pack() text = Text(frame) text.pack() root.mainloop()
you'll see that each thread sleeps for a minute but the input button doesn't wait for the output and is ready to take the next input. Once each thread finishes it prints the 'bye' message.
I'm fairly new to multi-threading myself so if you find any issues with this let me know or any doubts.
thanks
-chandra
-chandra
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Python Marketplace
Similar Threads
- maximum of an array using threads ?? (a shout for help) (C)
- threads (Java)
- What is Multi-Quote (DaniWeb Community Feedback)
- Help regarding multi-threading (C)
- Do i have to use multi threads?? (C)
- Multi-threading with C++.NET (C++)
Other Threads in the Python Forum
- Previous Thread: using ctypes to access a dll created by scons
- Next Thread: Custom Events with wx.PyEvent


Linear Mode