ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
first.py
Go to the documentation of this file.
1 from ROOT import TCanvas, TF1, TPaveLabel, TPad, TText
2 from ROOT import gROOT
3 
4 
5 nut = TCanvas( 'nut', 'FirstSession', 100, 10, 700, 900 )
6 nut.Range( 0, 0, 20, 24 )
7 nut.SetFillColor( 10 )
8 nut.SetBorderSize( 2 )
9 
10 pl = TPaveLabel( 3, 22, 17, 23.7, 'My first PyROOT interactive session', 'br' )
11 pl.SetFillColor( 18 )
12 pl.Draw()
13 
14 t = TText( 0, 0, 'a' )
15 t.SetTextFont( 62 )
16 t.SetTextSize( 0.025 )
17 t.SetTextAlign( 12 )
18 t.DrawText( 2, 20.3, 'PyROOT provides ROOT bindings for Python, a powerful interpreter.' )
19 t.DrawText( 2, 19.3, 'Blocks of lines can be entered typographically.' )
20 t.DrawText( 2, 18.3, 'Previous typed lines can be recalled.' )
21 
22 t.SetTextFont( 72 )
23 t.SetTextSize( 0.026 )
24 t.DrawText( 3, 17, r'>>> x, y = 5, 7' )
25 t.DrawText( 3, 16, r'>>> import math; x*math.sqrt(y)' )
26 t.DrawText( 3, 14, r'>>> for i in range(2,7): print "sqrt(%d) = %f" % (i,math.sqrt(i))' )
27 t.DrawText( 3, 10, r'>>> import ROOT; f1 = ROOT.TF1( "f1", "sin(x)/x", 0, 10 )' )
28 t.DrawText( 3, 9, r'>>> f1.Draw()' )
29 t.SetTextFont( 81 )
30 t.SetTextSize( 0.018 )
31 t.DrawText( 4, 15, '13.228756555322953' )
32 t.DrawText( 4, 13.3, 'sqrt(2) = 1.414214' )
33 t.DrawText( 4, 12.7, 'sqrt(3) = 1.732051' )
34 t.DrawText( 4, 12.1, 'sqrt(4) = 2.000000' )
35 t.DrawText( 4, 11.5, 'sqrt(5) = 2.236068' )
36 t.DrawText( 4, 10.9, 'sqrt(6) = 2.449490' )
37 
38 pad = TPad( 'pad', 'pad', .2, .05, .8, .35 )
39 pad.SetFillColor( 42 )
40 pad.SetFrameFillColor( 33 )
41 pad.SetBorderSize( 10 )
42 pad.Draw()
43 pad.cd()
44 pad.SetGrid()
45 
46 f1 = TF1( 'f1', 'sin(x)/x', 0, 10 )
47 f1.Draw()
48 nut.cd()
49 nut.Update()