Uniform Font Size Across Various Display Types
Opened this issue · 4 comments
Describe the desired new or improved feature.
The plot text is very small, on a 4K laptop monitor.
Can the text size of PyBERT labels be regularized across display types somehow?
Expected behavior
Text size appears the same, no matter the display resolution.
Screenshots
(n/a)
Desktop (please complete the following information):
- OS: Windows 10
- Python Version 3.7.6
- PyBERT Version 3.3.2
Additional context
Original Issue on Chaco GitHub site
I've experimented with explicitly specifying the ETS toolkit with varying degrees of success:
from traits.etsconfig.api import ETSConfig
# ETSConfig.toolkit = 'qt.celiagg' # Yields unacceptably small font sizes in plot axis labels.
# ETSConfig.toolkit = 'qt.qpainter' # Was causing crash on Mac.
I asked about this on StackOverflow:
https://stackoverflow.com/questions/60415306/how-to-automatically-accommodate-different-display-resolutions-in-chaco-plots
Here is some documentation on setting the ETS toolkit:
https://docs.enthought.com/pyface/toolkits.html
It offers this suggestion:
by setting the environment variable ETS_TOOLKIT to the name of the desired toolkit.
So, I tried that:
(pybert-dev)
capnf@DESKTOP-G84ND7C MINGW64 ~/Documents/GitHub/PyBERT (master)
$ echo $ETS_TOOLKIT
qt5
==> See this comment by Corran Webster, re: the use of "qt5".
But, it yields this error:
(pybert-dev)
capnf@DESKTOP-G84ND7C MINGW64 ~/Documents/GitHub/PyBERT (master)
$ python -m pybert &
[1] 3980
(pybert-dev)
capnf@DESKTOP-G84ND7C MINGW64 ~/Documents/GitHub/PyBERT (master)
$ Traceback (most recent call last):
File "C:\Users\capnf\anaconda3\envs\pybert-dev\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\capnf\anaconda3\envs\pybert-dev\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\capnf\Documents\GitHub\PyBERT\pybert\__main__.py", line 2, in <module>
from pybert.pybert import PyBERT
File "C:\Users\capnf\Documents\GitHub\PyBERT\pybert\pybert.py", line 29, in <module>
from chaco.api import ArrayPlotData, GridPlotContainer
File "C:\Users\capnf\anaconda3\envs\pybert-dev\lib\site-packages\chaco\api.py", line 314, in <module>
from .plots.horizon_plot import BandedMapper
File "C:\Users\capnf\anaconda3\envs\pybert-dev\lib\site-packages\chaco\plots\horizon_plot.py", line 14, in <module>
from enable.api import transparent_color_trait
File "C:\Users\capnf\anaconda3\envs\pybert-dev\lib\site-packages\enable\api.py", line 184, in <module>
from .base import (
File "C:\Users\capnf\anaconda3\envs\pybert-dev\lib\site-packages\enable\base.py", line 41, in <module>
from .colors import color_table, transparent_color
File "C:\Users\capnf\anaconda3\envs\pybert-dev\lib\site-packages\enable\colors.py", line 287, in <module>
from traitsui.qt4.color_editor import (
File "C:\Users\capnf\anaconda3\envs\pybert-dev\Lib\site-packages\shiboken2\files.dir\shibokensupport\feature.py", line 139, in _import
return original_import(name, *args, **kwargs)
File "C:\Users\capnf\anaconda3\envs\pybert-dev\lib\site-packages\traitsui\qt4\__init__.py", line 35, in <module>
from . import toolkit
File "C:\Users\capnf\anaconda3\envs\pybert-dev\Lib\site-packages\shiboken2\files.dir\shibokensupport\feature.py", line 139, in _import
return original_import(name, *args, **kwargs)
File "C:\Users\capnf\anaconda3\envs\pybert-dev\lib\site-packages\traitsui\qt4\toolkit.py", line 31, in <module>
assert_toolkit_import(["qt4", "qt"])
File "C:\Users\capnf\anaconda3\envs\pybert-dev\lib\site-packages\traitsui\toolkit.py", line 39, in assert_toolkit_import
raise RuntimeError(
RuntimeError: Importing from qt4 backend after selecting qt5 backend!
It looks like the enable
package might be enforcing usage of Qt4!
I do build a custom version of enable
.
Maybe, I need to rebuild it to use Qt5?
==> Nope. See this comment by Corran Webster.
Here's another page on explicitly defining the toolkit, this one from Enable's perspective:
https://docs.enthought.com/enable/enable/toolkit_selection.html
It offers this handy tip:
If you wish to test toolkit/backend combinations without the need for code modifications, you can set the ETS_TOOLKIT environment variable before running your application. ETSConfig will use the value of that environment variable to initialize its toolkit and kiva_backend properties. Here’s what that looks like:
$ export ETS_TOOLKIT=qt.qpainter
$ python kiva/examples/kiva/kiva_explorer.py