How to adjust tooltip font size in python console?

A forum for research and development of the user interface of FreeCAD
mannycrafts
Posts: 4
Joined: Fri Oct 07, 2022 11:41 pm

How to adjust tooltip font size in python console?

Post by mannycrafts »

Hello, could someone please explain how to adjust the font size for tooltips in the python console( if it's possible to do this)?
It's too tiny to read on my 4k monitor. :(

Code: Select all

OS: macOS 10.16
Word size of FreeCAD: 64-bit
Version: 0.20.29177 (Git)
Build type: Release
Branch: (HEAD detached at 0.20)
Hash: 68e337670e227889217652ddac593c93b5e8dc94
Python 3.9.13, Qt 5.12.9, Coin 4.0.0, Vtk 9.1.0, OCC 7.5.3
Locale: C/Default (C)
Attachments
The tooltip, highlighted
The tooltip, highlighted
freecad-python-console-tooltip-font.jpg (127.1 KiB) Viewed 2114 times
Syres
Veteran
Posts: 2493
Joined: Thu Aug 09, 2018 11:14 am

Re: How to adjust tooltip font size in python console?

Post by Syres »

mannycrafts wrote: Mon Oct 10, 2022 4:26 am Hello, could someone please explain how to adjust the font size for tooltips in the python console( if it's possible to do this)?
It's too tiny to read on my 4k monitor.
It's not a proper fix but that's another story, I just added a line font: 12pt; to the QTootip section of my stylesheet as per:

Code: Select all

/*==================================================================================================
Tooltip
==================================================================================================*/
QToolTip {
    color: #1e1e1e;
    background-color: #b4b4b4;
    /*opacity: 90%; doesn't correctly work */
    padding: 4px;
    border-radius: 3px; /* has no effect */
    font: 12pt;
}
I've attached a zip of my stylesheet which probably isn't to your taste if you just wanted to swap it to try.
Attachments
Behave-dark.zip
(10.9 KiB) Downloaded 59 times
wmayer
Founder
Posts: 20074
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: How to adjust tooltip font size in python console?

Post by wmayer »

You can change it this way:

Code: Select all

from PySide2 import QtWidgets
font = QtWidgets.QToolTip.font()
font.pointSize() # returns 9
font.setPointSize(15) # increase to 15
QtWidgets.QToolTip.setFont(font)
mannycrafts
Posts: 4
Joined: Fri Oct 07, 2022 11:41 pm

Re: How to adjust tooltip font size in python console?

Post by mannycrafts »

This works perfect, thanks for sharing!
mannycrafts
Posts: 4
Joined: Fri Oct 07, 2022 11:41 pm

Re: How to adjust tooltip font size in python console?

Post by mannycrafts »

Syres wrote: Mon Oct 10, 2022 11:40 am
mannycrafts wrote: Mon Oct 10, 2022 4:26 am Hello, could someone please explain how to adjust the font size for tooltips in the python console( if it's possible to do this)?
It's too tiny to read on my 4k monitor.
It's not a proper fix but that's another story, I just added a line font: 12pt; to the QTootip section of my stylesheet as per:

Code: Select all

/*==================================================================================================
Tooltip
==================================================================================================*/
QToolTip {
    color: #1e1e1e;
    background-color: #b4b4b4;
    /*opacity: 90%; doesn't correctly work */
    padding: 4px;
    border-radius: 3px; /* has no effect */
    font: 12pt;
}
I've attached a zip of my stylesheet which probably isn't to your taste if you just wanted to swap it to try.
Thanks for solution @Syres ! I looked to https://wiki.freecadweb.org/Interface_C ... ion#Themes for guidance on how to use your modified theme, but am stuck on how to apply the styles. Could you please explain how to use them, or point me to documentation if any exists?
Adding the snippet in the supposed stylesheet directory on a my Mac didn't seem to work. :(
Attachments
freecad-stylesheet-location-mac.jpg
freecad-stylesheet-location-mac.jpg (115.6 KiB) Viewed 1978 times
Syres
Veteran
Posts: 2493
Joined: Thu Aug 09, 2018 11:14 am

Re: How to adjust tooltip font size in python console?

Post by Syres »

mannycrafts wrote: Tue Oct 11, 2022 12:32 am I looked to https://wiki.freecadweb.org/Interface_C ... ion#Themes for guidance on how to use your modified theme, but am stuck on how to apply the styles. Could you please explain how to use them, or point me to documentation if any exists?
Adding the snippet in the supposed stylesheet directory on a my Mac didn't seem to work. :(
The best I can do is point you to the Qt docs https://doc.qt.io/qt-5/stylesheet-examples.html, I'm not an expert on stylesheets, I just change one thing at a time until I can get what I want based on the nearest available qss to my needs.
mannycrafts
Posts: 4
Joined: Fri Oct 07, 2022 11:41 pm

Re: How to adjust tooltip font size in python console?

Post by mannycrafts »

Very much appreciated!
User avatar
MisterMaker
Posts: 694
Joined: Mon Sep 21, 2020 7:41 am

Re: How to adjust tooltip font size in python console?

Post by MisterMaker »

Is this an addon? Because I cannot find any way to to activate this tooltip.
User avatar
onekk
Veteran
Posts: 5658
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: How to adjust tooltip font size in python console?

Post by onekk »

MisterMaker wrote: Sun Oct 16, 2022 10:23 am Is this an addon? Because I cannot find any way to to activate this tooltip.
You are speaking of the "Python Console" helper?

It is easy as typing in "Python Console" as example:

Code: Select all

FreeCAD.Vector.
When you type the "point" and wait some "milliseconds" you will see the "possible completions" and if you select one of them you will see even an help message, and at least on my Linux install, you could use the arrow key to move up and down the list that appear and show the "help message" that are usually "docstrings" or "code comments" present in source code.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
User avatar
MisterMaker
Posts: 694
Joined: Mon Sep 21, 2020 7:41 am

Re: How to adjust tooltip font size in python console?

Post by MisterMaker »

AHA it is capital sensitive. I was just typing in freecad. and nothing happend. :lol:
But checked my theme's on my 4K screen and was pretty good readable.
Post Reply