-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Type of Issue (Enhancement, Error, Bug, Question)
Question
Operating System
Windows version 10
PySimpleGUI Port (tkinter, Qt, Wx, Web)
tkinter
Versions
Version information can be obtained by calling sg.main_get_debug_data()
Or you can print each version shown in ()
Python version (sg.sys.version
)
3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)]
PySimpleGUI Version (sg.__version__
)
4.39.1
GUI Version (tkinter (sg.tclversion_detailed
), PySide2, WxPython, Remi)
8.6.9
Your Experience In Months or Years (optional)
5 Years Python programming experience
35 Years Programming experience overall
Yes Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine)
Troubleshooting
These items may solve your problem. Please check those you've done by changing - [ ] to - [X]
- Searched main docs for your problem www.PySimpleGUI.org
- Looked for Demo Programs that are similar to your goal Demos.PySimpleGUI.org
- If not tkinter - looked for Demo Programs for specific port
- For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
- Run your program outside of your debugger (from a command line)
- Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
- Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released
Detailed Description
I need to reference the default font without changing it (i.e. for using functions like sg.Text.char_width_in_pixels).
In documentation under "Common Element Parameters"/ "Font" it is reported as follows:
If you wish to leave the font family set to the default, you can put anything not a font name as the family. The PySimpleGUI Demo programs and documentation use the family 'Any' to demonstrate this fact.. You could use "default" if that's more clear to you.
There are 2 formats that can be used to specify a font... a string, and a tuple Tuple - (family, size, styles) String - "Family Size Styles"
I tried the above but I see an issue with the font size that it is bigger than default.
What is the correct/supported way of referencing the default font?
Code To Duplicate
import PySimpleGUI as sg
layout = [
[sg.Text('Font not specified (default)'),],
[sg.Text('Font specified as (\'Any\')', font=('Any')),],
[sg.Text('Font specified as \'Any\'', font='Any'),],
[sg.Text('Font specified as (\'Any 10\')', font=('Any 10')),],
[sg.Text('Font specified as \'Any 10\'', font='Any 10'),],
[sg.Text('Font specified as None', font=None),],
]
window = sg.Window('Default font', layout, finalize=True)
while True:
event, values = window.read()
if event == sg.WIN_CLOSED:
break
window.close()