This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Python Tkinter after method silently exits (corrected)

[Sorry for the spam; a paste bug omitted imports
 from the original program.  I've consolidated my
 previous 2 emails here; please ignore the earlier

On upgrading to the latest 1.5.19-4 cygwin release, I
find that several previously working python programs
began mysteriously exiting.  I've boiled the problem
down to a skeletal test program (attached), which runs
under the prior 1.5.18-1 release but exits under 1.5.19-4.

The second thread seems necessary to stimulate the failure;
even commenting out the sleep(100) to make it return
immediately avoides the spurious exit.  When the second
thread is running, the self.root.after(...) call
apparently causes a silent exit rather than returning.

I'm using python 2.4.1 (the
current cygwin distribution) in both cases.  The test
program fails with a current, up-to-date cygwin setup;
downgrading ONLY cygwin1.dll to 1.5.18-1 causes it to
work, suggesting that the problem is with cygwin1.dll
rather than with python.

Any help/ideas would be appreciated...

- Steve Ward

# Demonstrate python/Tkinter threading bug

import sys, types, os, threading
import Tkinter as TK
from time import sleep

class App:

def __init__(self, root):

        self.root = root

        # Start a second thread, to do whatever...
        self.thread = threading.Thread(target=self.second_thread)

    def update_loop(self):
        print >>sys.stderr, "*** update_loop"
        self.root.after(400, self.update_loop)

    def second_thread(self):

if __name__ == "__main__":
    root = TK.Tk()
    app = App(root)

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]