Subscript problem for greek letters in python print function

  • Context: Python 
  • Thread starter Thread starter Arman777
  • Start date Start date
  • Tags Tags
    Function Python
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
6 replies · 4K views
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
 
Physics 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.