Subscript problem for greek letters in python print function

  • Context: Python 
  • Thread starter Thread starter Arman777
  • Start date Start date
  • Tags Tags
    Function Python
Click For Summary

Discussion Overview

The discussion revolves around the challenges of displaying Greek letters with subscripts in a Python GUI using PySimpleGUI. Participants explore issues related to specific characters not rendering correctly and suggest alternative tools or resources.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant describes their attempt to use subscripts for Greek letters in a PySimpleGUI application, noting that certain combinations work while others do not.
  • Another participant suggests that programming questions are better suited for Stack Overflow, citing its active community.
  • A participant mentions the PyLaTeX library as a potential alternative for handling LaTeX in Python.
  • Some participants point out a possible misspelling of "lambda" in the code and question the presence of accents on certain letters, suggesting that this might affect rendering.
  • There is a suggestion that there may not be subscript Unicode characters available for certain Greek letters, leading to the observed issues.
  • A later reply recommends checking out the MathJax extension for Python markdown as another resource for rendering mathematical expressions.

Areas of Agreement / Disagreement

Participants express differing views on the best approach to resolve the issue, with no consensus on a single solution or explanation for the rendering problems.

Contextual Notes

There are unresolved questions about the availability of subscript Unicode characters for specific Greek letters, and the discussion includes potential misspellings that may contribute to the issues raised.

Arman777
Insights Author
Gold Member
Messages
2,163
Reaction score
191
I am trying to create a GUI for a phyiscs project and I need subscripts of these things.
`H_0`,
`Omega_b`,
`Omega_dm`,
`Omega_\Lambda`
`Omega_r`
in the form of latex

My code is something like this


Python:
    import PySimpleGUI as sg

    sg.change_look_and_feel('Topanga')     

    layout = [
        [sg.Text('Enter the Parameters')],
        [sg.Text("H\N{SUBSCRIPT ZERO}", size=(15, 1)), sg.InputText()],
        [sg.Text("\N{GREEK CAPITAL LETTER OMEGA}\N{LATIN SUBSCRIPT SMALL LETTER B}", size=(15, 1)), sg.InputText()],
        [sg.Text("\N{GREEK CAPITAL LETTER OMEGA}\N{LATIN SUBSCRIPT SMALL LETTER R}", size=(15, 1)), sg.InputText()],
        [sg.Text("\N{GREEK CAPITAL LETTER OMEGA}\N{GREEK SUBSCRIPT SMALL LETTER LAMDA}", size=(15, 1)), sg.InputText()],
        [sg.Text("\N{GREEK CAPITAL LETTER OMEGA}\N{LATIN SUBSCRIPT SMALL LETTER DM}", size=(15, 1)), sg.InputText()],
        [sg.Text("z", size=(15, 1)), sg.InputText()],
        [sg.Submit(), sg.Cancel()]
    ]

    window = sg.Window('Simple data entry window', layout)
    event, values = window.read()
    window.close()
    print(event, values[0], values[1], values[2], values[3], values[4], values[5])

The most interesting thing is that it can print letters such as `M` or `R` but it cannot print `B` ?? Or It can print `phi` but it cannot print `lambda` ?

You can try this to see that this combination works.


Python:
import PySimpleGUI as sg

    sg.change_look_and_feel('Topanga')     

    layout = [
        [sg.Text('Enter the Parameters')],
        [sg.Text("H\N{SUBSCRIPT ZERO}", size=(15, 1)), sg.InputText()],
        [sg.Text("\N{GREEK CAPITAL LETTER OMEGA}\N{LATIN SUBSCRIPT SMALL LETTER M}", size=(15, 1)), sg.InputText()],
        [sg.Text("\N{GREEK CAPITAL LETTER OMEGA}\N{LATIN SUBSCRIPT SMALL LETTER R}", size=(15, 1)), sg.InputText()],
        [sg.Text("\N{GREEK CAPITAL LETTER OMEGA}\N{GREEK SUBSCRIPT SMALL LETTER PHI}", size=(15, 1)), sg.InputText()],
        [sg.Text("z", size=(15, 1)), sg.InputText()],
        [sg.Submit(), sg.Cancel()]
    ]

    window = sg.Window('Simple data entry window', layout)
    event, values = window.read()
    window.close()
    print(event, values[0], values[1], values[2], values[3], values[4], values[5])
Please help,
Thanks
 
Technology news on Phys.org
Hey Arman, I think that for programming questions you should ask on stackoverflow and not here. That community is humongous and extremely active, you could get answers within minutes.
https://stackoverflow.com/
 
  • Skeptical
Likes   Reactions: Greg Bernhardt
archaic said:
Hey Arman, I think that for programming questions you should ask on stackoverflow and not here. That community is humongous and extremely active, you could get answers within minutes.
https://stackoverflow.com/
I asked there but i didnt get an answer
 
  • Like
Likes   Reactions: Greg Bernhardt
Arman777 said:
Or It can print `phi` but it cannot print `lambda` ?
Well, for starters, you misspelled lambda in the line below.
Code:
[sg.Text("\N{GREEK CAPITAL LETTER OMEGA}\N{GREEK SUBSCRIPT SMALL LETTER LAMDA}", size=(15, 1)), sg.InputText()],

Why are there accents on many of your letters? In the first line I quoted there are accents on the p in phi and the l in lambda.
 
Mark44 said:
Well, for starters, you misspelled lambda in the line below.
https://www.fileformat.info/info/unicode/char/03bb/index.htm
Mark44 said:
Why are there accents on many of your letters? In the first line I quoted there are accents on the p in phi and the l in lambda.
Thats indeed strange. I don't know why it happened.
I guess I understand the problem. There is just not subscript unicode for lambda or for some letters.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
6K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
5K
Replies
0
Views
2K
  • · Replies 18 ·
Replies
18
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 9 ·
Replies
9
Views
4K