1

i'm trying to build a menu based on persian language in pysimplegui . i want my whole menu have RTL direction . are there any suggestions ?

S.Katuzian
  • 13
  • 6

1 Answers1

1

tkinter doesn't support it, of course, also no for PySimpleGUI.

To put the menu on the right side, you can try ButtonMenu element.

import PySimpleGUI as sg

headings = ['President', 'Date of Birth']
data = [
    ['Ronald Reagan', 'February 6'],
    ['Abraham Lincoln', 'February 12'],
    ['George Washington', 'February 22'],
    ['Andrew Jackson', 'March 15'],
    ['Thomas Jefferson', 'April 13'],
    ['Harry Truman', 'May 8'],
    ['John F. Kennedy', 'May 29'],
    ['George H. W. Bush', 'June 12'],
    ['George W. Bush', 'July 6'],
]
menu_def = [
    ['&File', ['&Open     Ctrl-O', '&Save       Ctrl-S', '&Properties', 'E&xit']],
    ['&Edit', ['&Paste', ['Special', 'Normal', ], 'Undo', 'Options::this_is_a_menu_key'], ],
    ['&Toolbar', ['---', 'Command &1', 'Command &2', '---', 'Command &3', 'Command &4']],
    ['&Help', ['&About...']]
]

layout = [
    [sg.Push(), sg.ButtonMenu('Menu', menu_def)],
    [sg.Table(data, headings=headings, justification='left', expand_x=True, key='-TABLE-')],
]
sg.Window('Demo', layout).read(close=True)

enter image description here

Jason Yang
  • 11,284
  • 2
  • 9
  • 23