Does PySimpleGUI
python library support RTL alignment?
I want to align Arabic text from right-to-left:
Code:
sg.Text("احب الطعام", font='12', size=(15, 1), background_color='#81a5b3')
Does PySimpleGUI
python library support RTL alignment?
I want to align Arabic text from right-to-left:
Code:
sg.Text("احب الطعام", font='12', size=(15, 1), background_color='#81a5b3')
This problem is with Visual Studio itself rather than PySimpleGUI. You can make typing in Right-To-Left languages (like Arabic, Persian, Hebrew, etc) work by doing the following:
Solution
>settings
in search bar and open Open User Settings (JSON)
*"editor.renderControlCharacters": false
and save the settings.json file.*You can set settings either to apply for everything the current Windows User
opens, Default
for the application so for all users' everything, or only per specific Workspace
.
Now, after a recent VS update only this should be enough for it to work: it will recognize when you are typing in a RTL language. If for some reason it does not work, also do the following:
Potential/additional workaround
U+202B
(or copy-paste from somewhere like here) at the start of the entry you want to type.I've tested it just now and it does work fine, but doesn't seem to love copy/pasted text instead of typed which could be annoying for long entries if it decides not to work with you for some reason.
Keyboard toggle
You can bind a key to toggle between RTL and LTR to make life easier in case you go back and forth a lot.
Ctrl+Shift+P
Type in search bar and open Open Keyboard shortcuts
(or press Ctrl+K)
Add editor.action.toggleRenderControlCharacter
to the search bar and set whatever keybind you want.
What this does is effectively add / remove the .json edit that is the solution (i.e. enable/disable RTL).