8from __future__ 
import print_function
 
   15      arg1 = (x[0]-par[1])/par[2]
 
   16      arg2 = (0.01*0.39894228)/par[2]
 
   17      arg3 = par[0]/(1+par[3])
 
   19      gauss = arg3*arg2*math.exp(-0.5*arg1*arg1)
 
   25tpygaus = ROOT.TF1( 
'pygaus', pygaus, -4, 4, 4 )
 
   26tpygaus.SetParameters( 1., 0., 1. )
 
   29   btn = ROOT.BindObject( ROOT.gTQSender, ROOT.TGTextButton )
 
   30   if btn.WidgetId() == 10:
 
   31      global tpygaus, window
 
   35m = ROOT.TPyDispatcher( MyDraw )
 
   38class pMainFrame( ROOT.TGMainFrame ):
 
   39   def __init__( self, parent, width, height ):
 
   40       ROOT.TGMainFrame.__init__( self, parent, width, height )
 
   42       self.Canvas    = ROOT.TRootEmbeddedCanvas( 
'Canvas', self, 200, 200 )
 
   43       self.AddFrame( self.Canvas, ROOT.TGLayoutHints(ROOT.kLHintsExpandX | ROOT.kLHintsExpandY) )
 
   44       self.ButtonsFrame = ROOT.TGHorizontalFrame( self, 200, 40 )
 
   46       self.DrawButton   = ROOT.TGTextButton( self.ButtonsFrame, 
'&Draw', 10 )
 
   47       self.DrawButton.Connect( 
'Clicked()', 
"TPyDispatcher", m, 
'Dispatch()' )
 
   48       self.ButtonsFrame.AddFrame( self.DrawButton, ROOT.TGLayoutHints() )
 
   50       self.ExitButton   = ROOT.TGTextButton( self.ButtonsFrame, 
'&Exit', 20 )
 
   51       self.ExitButton.SetCommand( 
'TPython::Exec( "raise SystemExit" )' )
 
   52       self.ButtonsFrame.AddFrame( self.ExitButton, ROOT.TGLayoutHints() )
 
   54       self.AddFrame( self.ButtonsFrame, ROOT.TGLayoutHints() )
 
   56       self.SetWindowName( 
'My first GUI' )
 
   58       self.Resize( self.GetDefaultSize() )
 
   65if __name__ == 
'__main__':
 
   66   window = pMainFrame( ROOT.gClient.GetRoot(), 200, 200 )