Running on Windows XP (SP3) on Toshiba Satellite pro.
Python 2.5.4
Eclipse 20090920
This is a modified example from the Root Python documentation
ftp://root.cern.ch/root/doc/19PythonRuby.pdf
Below is a code sample which demonstrates inconsistent behaviour of the PyRoot call to TCanvas.
There are 2 lines with ‘c1=TCanvas…’
Run the version below (with the second call to TCanvas commented out)and only 5 calls to the ‘print index’ are displayed in the Eclipse ouput window, then a Root blank canvas window is displayed. Then the program hangs.
Now coment out the first version of c1=TCanvas… and remove the comment # from the second call to c1=TCanvas…
Now when you run all 25000 ‘print index’ values are displayed in the Eclipse output window and the Root canvas window is displayed correctly with the appropriate values in the histogram.
The second version confirms the paths etc are valid and the overall system is correctly configured.
I have checked on a colleague’s machine and both versions of the code work on an Apple Mac & a Linux (CERN Scientific) PC, so this appears to be restricted to Windows.
Expected behaviour: Root should give the same result with either call to TCanvas().
‘’’
Created on 2 Nov 2009
@author: Tony Poll
‘’’
from ROOT import gRandom,TCanvas,TH1F #@UnresolvedImport
Placing the call the TCanvas here does not work. Graph is never displayed
c1 = TCanvas(‘c1’,‘Example’,200,10,700,500)
hpx = TH1F(‘hpx’,‘px’, 100, -4, 4)
for index in xrange(25000):
print index
px = gRandom.Gaus()
hpx.Fill(px)
Placing the call the TCanvas here works
#c1 = TCanvas(‘c1’,‘Example’,200,10,700,500)
hpx.Draw()
c1.Update()
graph.py (482 Bytes)