mappingcharactertextinputpysimpleguiequivalent

How to get character's equivalent from another TextInput using PySimpleGUI?


Dears,

How to get character's equivalent from another TextInput using PySimpleGUI? Let me explain: Suppose I have those sets of data , set A and Set B, my query is once I write one characters in TextInput 1 from Set A I'll get automatically it's equivalent in Set B; For example Set A : A, B, C, D, ........, Z Set B : 1, 2, 3,4, ..........,26

So if I write ABC in TextInut A --> I'll get : 123 in TextInput B

Thanks in advance

import PySimpleGUI as sg

enter image description here


Solution

  • My apologies if I misunderstand your question.

    First, special characters, like ☯, ∫, β, etc., are just Unicode characters. You can type them directly into your editor or use the Unicode escape codes. You might see this question for more help.

    Second, it is unclear when you want to make this mapping. It is easiest if you type characters and then map at the end. If you want to do interactively that is harder. You can get each individual keyboard event; see (this answer)[https://stackoverflow.com/a/74214510/1320510] for an example. Because I know of no way of the exact position, you might be better getting the events, and writing the display to a second label. I would need to more a bit more about what you are doing.

    Keep hacking! Keep notes.

    Charles