14 arg1 = (x[0]-par[1])/par[2]
15 arg2 = (0.01*0.39894228)/par[2]
16 arg3 = par[0]/(1+par[3])
18 gauss = arg3*arg2*math.exp(-0.5*arg1*arg1)
24tpygaus = ROOT.TF1(
'pygaus', pygaus, -4, 4, 4 )
25tpygaus.SetParameters( 1., 0., 1. )
28 btn = ROOT.BindObject( ROOT.gTQSender, ROOT.TGTextButton )
29 if btn.WidgetId() == 10:
30 global tpygaus, window
34m = ROOT.TPyDispatcher( MyDraw )
37class pMainFrame( ROOT.TGMainFrame ):
38 def __init__( self, parent, width, height ):
39 ROOT.TGMainFrame.__init__( self, parent, width, height )
41 self.Canvas = ROOT.TRootEmbeddedCanvas(
'Canvas', self, 200, 200 )
42 self.AddFrame( self.Canvas, ROOT.TGLayoutHints(ROOT.kLHintsExpandX | ROOT.kLHintsExpandY) )
43 self.ButtonsFrame = ROOT.TGHorizontalFrame( self, 200, 40 )
45 self.DrawButton = ROOT.TGTextButton( self.ButtonsFrame,
'&Draw', 10 )
46 self.DrawButton.Connect(
'Clicked()',
"TPyDispatcher", m,
'Dispatch()' )
47 self.ButtonsFrame.AddFrame( self.DrawButton, ROOT.TGLayoutHints() )
49 self.ExitButton = ROOT.TGTextButton( self.ButtonsFrame,
'&Exit', 20 )
50 self.ExitButton.SetCommand(
'TPython::Exec( "raise SystemExit" )' )
51 self.ButtonsFrame.AddFrame( self.ExitButton, ROOT.TGLayoutHints() )
53 self.AddFrame( self.ButtonsFrame, ROOT.TGLayoutHints() )
55 self.SetWindowName(
'My first GUI' )
57 self.Resize( self.GetDefaultSize() )
64if __name__ ==
'__main__':
65 window = pMainFrame( ROOT.gClient.GetRoot(), 200, 200 )