simple threading (or not as the case may be)

Mark Robinson m.1.robinson at herts.ac.uk
Wed Oct 10 08:35:36 EDT 2001


Thanks for the advice there

It may be that threads aren't the solution anyway.
I'll explain in a bit more detail my aim and perhaps
someone can help.

I am working in jython2.1a3 with java 2 (1.3.0_01)

I have created a progressBar to monitor the progress
of a potentially time consuming function. I don't really
think it belongs in a thread because all following code
requires the output of this function.

My problem is that when running the progress bar never draws
itself or updates. The following test code works fine:

if __name__ == '__main__':
     f = swing.JFrame()
     p = progress(f, 0, 18)
     y = 0
     while y < 18:
         if y > 5 and y < 12:
             p.setLabel('Welcome to the ministry of silly walks')
         else:
             p.setLabel('Nee, nee!')
         for x in range(50000):
             pass
         y += 1
         p.setProgress(y)
     p.close()
     import sys
     sys.exit()


However, in the following context it does sod all:

if mode != 'pali':
         """find all valid L length sites"""
         pm.setLabel('Generating sequence patterns...')
         Bsites = motifFinder.genBsites()
         pm.setProgress(1)

         """Generate a list of sites in positional order"""
         posList = getPosList(Bsites)
         del Bsites
         pm.setProgress(2)

         """generate double motifs"""
         pm.setLabel('Generating duel element motifs...')
         doubles = motifFinder.genDoubles(posList, pm)
         if not Motif.duplicates:
             doubles = trimResults(doubles)
         pm.setProgress(12)


Can anyone help?

TIA
Blobby




More information about the Python-list mailing list