#script to check size preservation of ROOT canvases

import os, sys
from ROOT import TFile, gROOT, TObject, TCanvas
gROOT.SetBatch(True)

def addc(clist, c):
    cnew = c.Clone()
    clist.append(cnew)
    print clist
    return clist

def main():
    
    clist = []
    
    c = TCanvas('c','c',600,100)
    c.Print('./temp_before_0.pdf')
    print c.GetWindowWidth(), c.GetWindowHeight()
    clist = addc(clist,c)
    c = TCanvas('c','c',100,600)
    c.Print('./temp_before_1.pdf')
    print c.GetWindowWidth(), c.GetWindowHeight()
    clist = addc(clist,c)
    
    clist[0].Print('./temp_after_0.pdf')
    print clist[0]
    print clist[0].GetWindowWidth(), clist[0].GetWindowHeight()
    clist[1].Print('./temp_after_1.pdf')
    print clist[1]
    print clist[1].GetWindowWidth(), clist[1].GetWindowHeight()




if __name__ == '__main__':
    main()
