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.

Attachments myForm.JPG 20.21 KB

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

from Tkinter import *
import threading
import time

class process(threading.Thread):
    def __init__(self):

    def run(self):
        print 'hello'
        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():
root = Tk()
frame = Frame(root)

#when user clicks button it calls 'startThread' command
but = Button(frame,text='start',command=startThread)

text = Text(frame)


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. Agni, sorry was out...
hm make sense .... so how I understand class "process" should communicate with procedure invoked from my "Start" button? This is the question for me: should class "process" contain my whole program or how ?

Does anybody else can suggest me how to tight my Start button with "class process(threading.Thread):" ?

Thanks in advance!

This article has been dead for over six months. Start a new discussion instead.