Home | News | Documentation | Download

Can't keep TBrowser alive on pyroot

Hi, I’m trying to use TBrowser to select a branch, but when I run

from ROOT import TBrowser
b=TBrowser

the browser just appeared for a while, then disappeared.
But if I run these codes on terminal, the browser can be opened well. Adding

raw_input()

doesn’t work as well. So I’m confused now. How should I open a TBrowser by running python script?

And, can I use SetSelected() like

b = TBrowser().SetSelected(branch)

to select the wanted branch? ( Or someway else?)
( The documentation mentions it less, so I’m not really sure…)

I’ll be appreciated if someone could help me :slight_smile:

ROOT Version: 6.22/02
Platform: Ubuntu 20.04
Compiler: Not Provided

Hi @mrli,
I am using ROOT v6.22/02 installed as a conda package on Linux. This correctly opens a TBrowser:

$ python
>>> from ROOT import TBrowser
>>> b = TBrowser()

What am I doing differently? Are you running the above code as a script? In that case, try running it as python -i script.py (note the -i option), that might help with problems with the GUI.

Hope this helps!
Enrico

I’m really sorry that I forgot to tell the way I run that code (Exactly as a script)…
It works, thank you very much!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.