Search code examples
pythonuser-interfacetkinterpysimplegui

How to set Armenian font for Text Input in PySimpleGUI?


I have a simple GUI code that accepts English and even Russian input but not Armenian, tried to input "Arial Armenian" font in code but it doesnt work, getting "?"-s instead of letters.

import PySimpleGUI as sg

# Define a font that supports Armenian characters
font = ('Arial Armenian', 12, 'normal')
sg.theme('DarkAmber')   # Add a touch of color

# All the stuff inside your window.
layout = [  [sg.Text('Some text on Row 1')],
        [sg.Text('Enter something on Row 2'), sg.InputText(font=font)],
        [sg.Button('Ok'), sg.Button('Cancel')] ]

# Create the Window
window = sg.Window('Window Title', layout)

# Event Loop to process "events" and get the "values" of the inputs
while True:
    event, values = window.read()
    if event == sg.WIN_CLOSED or event == 'Cancel': # if user closes window or clicks cancel
        break
    print('You entered ', values[0])

window.close()

Solution

  • After installed Arial Armenian font on my WIN10, and also the IME.

    I don't know how to input Armenian, but it seems work fine, no "?"-s found.

    >>> 'Arial Armenian' in sg.Text.fonts_installed_list()
    True
    

    enter image description here

    Of course, it show different characters on my console.

    You entered  Ö„Õ¸Õ¥Õ¼Õ¿Õ¨Ö‚Õ«Ö…Õº