ROOT GUI scaling

I tried with a and a rootlogon.C and I obtain the same results, could you share both of the files you use? I will use them to check the value of some gEnv property after python / root startup.

Here they are:
.rootlogon.C (1.1 KB) (780 Bytes)

How to reproduce my problem:

  1. Open root, type
    TCanvas *c = new TCanvas()
  2. A canvas with huge menu font will appear
  3. Open python
    import ROOT
    c = ROOT.TCanvas()
  4. A canvas with a standard, small menu font will appear

So what I found is that the settings in gEnv are indeed visible from PyROOT too:

[etejedor@pcepsft999 build_oldpyroot_py2]$ python
Python 2.7.13 (default, May  9 2017, 16:39:50) 
[GCC 7.1.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>> ROOT.TCanvas
<class 'ROOT.TCanvas'>
>>> ROOT.gEnv.GetValue("GUI.DefaultFont", "default")

do you also get this?

And in my case, both the C++ code and the Python one open the same canvas (the font of the menu is the same)

Yes, as I was writing before, proper gEnv settings are visible from pyROOT in my case, but do not seem to have any effect.

You have the same font in canvas from C++ and Python code - correct, big one, or standard one?

I have the standard one in both cases, I think nothing changes.

So I understand, that in your case font settings have no effect in both C++ and Python… Well, at least that should be easy to trace and fix :slight_smile:

Perhaps @couet can confirm that the font settings do not work in C++ either (see rootlogon.C attached by the user)?

But they do work in C++ here. They don’t work in python only.

I am a bit confused as I was asked to join this long thread just now. Seems to me this kind of settings should be in $ROOTSYS/etc/system.rootrc . Not in a macro … did I miss something ?

Indeed, they work OK both in C++ and pyROOT when I put them into system.rootrc. However, the whole discussion started as an answer to a problem: how to change ROOT font size to resonable one depending on monitor resolution, because it does not readout monitor scaling from the operating system.

Yes, Bertrand explained me… I am afraid I do not have more input to give.

But, in my case the solution works in C++, it doesn’t work in pyROOT. So these kind of settings can be done, in principle, in a startup script. Unless it is a bug, not a feature, I guess it could also work in pyROOT, just something is preventing it, and hopefully can be easily fixed.

Well, I tried on Windows, and is never executed. When I try python, here is what I get:

  File "", line 2
    print "aaa"

So how can I try?

OK, so after fixing the script, if I start python -i, then everything works fine, like with rootlogon.C. So for me there is nothing to fix…

So, if you set menu font size to, for example, 20, in, run python and create a canvas, you get this large font in the canvas menu?

Yes, absolutely (but since PyROOT doesn’t wotk well on Windows, I can’t show you any screenshot…)

No need, I trust you :slight_smile: If only someone could confirm that it works in the same way on linux, I would know that the trouble is somewhere in my system…

It works as well for me on Linux…

[bellenot@bbcc7x64 rootdev]$ python -i
xrandr: Failed to get size of gamma for output default
>>> b = ROOT.TBrowser()

And I got a TBrowser with huge font

Thank you! I’ll try to trace the issue in my system.