16 arg1 = (x[0] - par[1]) / par[2]
17 arg2 = (0.01 * 0.39894228) / par[2]
18 arg3 = par[0] / (1 + par[3])
20 gauss = arg3 * arg2 * math.exp(-0.5 * arg1 * arg1)
27tpygaus = ROOT.TF1(
"pygaus", pygaus, -4, 4, 4)
28tpygaus.SetParameters(1.0, 0.0, 1.0)
32 btn = ROOT.BindObject(ROOT.gTQSender, ROOT.TGTextButton)
33 if btn.WidgetId() == 10:
34 global tpygaus, window
39class pMainFrame(ROOT.TGMainFrame):
40 def __init__(self, parent, width, height):
41 ROOT.TGMainFrame.__init__(self, parent, width, height)
43 self.Canvas = ROOT.TRootEmbeddedCanvas(
"Canvas", self, 200, 200)
44 self.AddFrame(self.Canvas, ROOT.TGLayoutHints(ROOT.kLHintsExpandX | ROOT.kLHintsExpandY))
45 self.ButtonsFrame = ROOT.TGHorizontalFrame(self, 200, 40)
47 self.DrawButton = ROOT.TGTextButton(self.ButtonsFrame,
"&Draw", 10)
48 self.DrawButton.Connect(
"Clicked()", MyDraw)
49 self.ButtonsFrame.AddFrame(self.DrawButton, ROOT.TGLayoutHints())
51 self.ExitButton = ROOT.TGTextButton(self.ButtonsFrame,
"&Exit", 20)
52 self.ExitButton.SetCommand(
'TPython::Exec( "raise SystemExit" )')
53 self.ButtonsFrame.AddFrame(self.ExitButton, ROOT.TGLayoutHints())
55 self.AddFrame(self.ButtonsFrame, ROOT.TGLayoutHints())
57 self.SetWindowName(
"My first GUI")
59 self.Resize(self.GetDefaultSize())
66if __name__ ==
"__main__":
67 window = pMainFrame(ROOT.gClient.GetRoot(), 200, 200)