Home | News | Documentation | Download

Hide TCanvas while running PyROOT

Hi all,

This problem has been solved in this thread for ROOT but what is the way of implementing the mentioned functions in PyROOT?

This is an example of what I’m trying to do:

c = TCanvas("c")
c.SetLogy(True)
histogram.Draw("h")
c.Print("output.pdf")

I was using Python 3.8 with ROOT 6.22 on my local computer since I wanted to test things out. No browser pops up when I ran the script in this setting.

However, when I moved to afs which I was using Python 2.7 and ROOT 6.20, a browser pops up everytime I executed this script. Any idea of what might be causing the difference?

Best, Wingfung :slight_smile:

Why not running in Batch mode ?

 gROOT->SetBatch(1);
1 Like

Hi @leungwingfung,
The suggestion by @couet is correct, in python you can write it like so:

import ROOT
ROOT.gROOT.SetBatch(1)

Cheers,
Vincenzo

1 Like