Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
#!/usr/bin/env python # -*- coding: utf-8 -*-
## Define the possible anchors canvas = 'DOC', stack = 'DOC', mainpad = 'DOC', legend = 'DOC', legendpad = 'DOC', debug = 'DOC', debugpad = 'DOC', )
""" This helper class with take ownership the attached TObject.
Usage::
## Init & attach >>> a = Anchors() >>> a.canvas = ROOT.TCanvas('name', 'title')
"""
""" Two possibilities:
If obj is False/None, this will explicitly disable this anchor and thus the respective object will not be shown.
If it's ROOT.TObject, then bind it normally.
""" ## Keep alive ## Pad needs to be drawn not, and everything else doesn't.
""" Recursively call `Update` of all its contents.
>>> a = Anchors() >>> a.canvas = ROOT.TCanvas('c2', 'title') >>> a.legend = ROOT.TLegend() >>> a.mainpad = ROOT.TPad('pad', 'pad', 0, 0, 1, 1) >>> a.update()
""" ## Drill down on existing pads. ## Usually needed ## last object
""" Delegation from canvas.SaveAs """ self.update() return self.canvas.SaveAs(*args)
# def __str__(self): # ## Print list of objects in self # msg = "" # tmp = '{:10} {}\n'.format # msg += tmp('NAME', 'INSTANCE') # for name in dir(self): # if not name.startswith('_'): # obj = getattr(self, name) # if not hasattr(obj, 'im_self'): # msg += tmp(name, obj) # return msg |