Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
gui_simple.py File Reference

Detailed Description

A Simple GUI Example.

import ROOT
def pygaus(x, par):
import math
if par[2] != 0.0:
arg1 = (x[0] - par[1]) / par[2]
arg2 = (0.01 * 0.39894228) / par[2]
arg3 = par[0] / (1 + par[3])
gauss = arg3 * arg2 * math.exp(-0.5 * arg1 * arg1)
else:
print("returning 0")
gauss = 0.0
return gauss
tpygaus = ROOT.TF1("pygaus", pygaus, -4, 4, 4)
tpygaus.SetParameters(1.0, 0.0, 1.0)
def MyDraw():
if btn.WidgetId() == 10:
global tpygaus, window
def __init__(self, parent, width, height):
ROOT.TGMainFrame.__init__(self, parent, width, height)
self.Canvas = ROOT.TRootEmbeddedCanvas("Canvas", self, 200, 200)
self.ButtonsFrame = ROOT.TGHorizontalFrame(self, 200, 40)
self.DrawButton = ROOT.TGTextButton(self.ButtonsFrame, "&Draw", 10)
self.DrawButton.Connect("Clicked()", MyDraw)
self.ButtonsFrame.AddFrame(self.DrawButton, ROOT.TGLayoutHints())
self.ExitButton = ROOT.TGTextButton(self.ButtonsFrame, "&Exit", 20)
self.ExitButton.SetCommand('TPython::Exec( "raise SystemExit" )')
self.ButtonsFrame.AddFrame(self.ExitButton, ROOT.TGLayoutHints())
self.AddFrame(self.ButtonsFrame, ROOT.TGLayoutHints())
self.SetWindowName("My first GUI")
self.MapSubwindows()
self.Resize(self.GetDefaultSize())
self.MapWindow()
def __del__(self):
self.Cleanup()
if __name__ == "__main__":
window = pMainFrame(ROOT.gClient.GetRoot(), 200, 200)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Author
Wim Lavrijsen

Definition in file gui_simple.py.