Python Virtual Keyboard with diacritical marks?

When transcribing text written in a foreign language, users probably do not have the localized unicode keyboard that displays the diacritical marks or glyphs.

The LexiLogos website has reference pages instructing how to type accented characters common to various specific languages.

For example, the Finnish keyboard pages lists:

The special characters can be
typed with the key [alt] and this code:

Ä Ö Å
142153143
ä ö å
132148134

The LexiLogos site has a series of HTML-script-based virtual buttons for a variety of languages. Not intended as a keyboard but to be used as a bridging technology by providing a unicode scratchpad.

Is there a Python multinational Virtual Keyboard that could be set up in a bottombar gramplet?

I’ve found a couple Python virtual keyboards that were standard US. (Such as the Python Kivy vkeyboard YouTube tutorial: Add Keyboard With VKeyboard - Python Kivy GUI Tutorial #62) But that doesn’t help with unicode.

What I have done is created a To Do note and have the To Do gramplet open on the dashboard.

After searching for the needed foreign character using either Windows’ Character Map or LibreOffice Write I will save the letter in the note ready for the next time it is needed.

Keeping a scratchpad Note and doing a character-by-character copy’n’paste to compose a note is an approach I’d only consider as a last resort.

It is easier to keep the hotlink for the Lexilogos webpage in the ToDo note. Then compose in their online edit box, copy the fully composed note to paste into a Gramps note. The process is a LOT less fussy.

(Copy’n’Paste in Gramps is agonizing because using the Ctrl-C keybinding is so ingrained after 30 years. Since that is remapped to copy to the Gramps Clipboard instead of the OS clipboard, I’d be swearing a blue streak if I used a Note as a unicode scratchpad.)

I do not see myself creating whole notes in anything but English. At most, I need to add a letter to a name or the £ sign to a will or a colonial property record.

I had bookmarked the link. Now I have added it to my To Do note as a link.

1 Like

I don’t know about Windows, but on a Mac or a Chromebook you can press and hold a letter key to get a pop-up list of accented versions of that letter to choose from.

I still can never recollect the dead key combinations for accented characters. So I spent the afternoon with Perplexity AI prompting it to create a simple virtual keyboard Gramplet. It is tested with 5.2 but should work with older and newer versions without tweaking.

You can use it with a touch screen to clipboard a string. It doesn’t have anything sophisticated… like repositioning the insertion point, pasting back into the text box, interacting with the keyboard (like Ctrl, Alt, Caps Lock or the other keys), keybindings or highlighting of the currently selected layout. (The gramplet is only 160 lines long.)

After adding a string to the textbox, click the Copy button to clipboard and paste into wherever it is needed. Click the Clear button to start again.

There are no configuration options. Nor does it save which layout is selected. It always defaults to the “Special” layout.

I have not used any of the keyboards that support special characters. So if there is a standard layout, I’m not aware of it. But it should be easy enough to change.


The gramplet is available as a manual download and install from my GitHub repository:
https://github.com/emyoulation/addons-source/tree/maintenance/gramps52/VirtualKeyboard

Thank you for creating this, or rather for having the idea and prompting Perplexity to create it. I think it will be useful and would like to try it, while at the same time trying to use a local Addon Manager “project”.

So, I downloaded the two files (“virtualkeyboard.gpr.py“ and “virtualkeyboard.py“) and put them in a folder (“VirtualKeyboard“) in my linux home .gramps/gramps52/plugins directory.

What next? Do I need to “tar” the directory (if so, what options should I use)? What URL should I specify in the Addon Manager?

I’m trying to do this as a naive user rather than as a pseudo-developer. I don’t know which is more dangerous! But if I can install your addon successfully, then I would feel comparable sharing any that I might create (not that anyone would want to install them).

Secondly, are you willing to share the prompts that you used (if you want to encourage this sort of thing)?

1 Like

I am uncomfortable suggesting the ways to build a local “project” until there is some feedback from @Nick-Hall as to how to troubleshoot a local path for a project. Not being about to troubleshoot will be too frustrating to the experimenter.

See:

You should be able to view the Perplexity interaction and the many, many iterations of prompts:
https://www.perplexity.ai/search/please-create-a-virtual-keyboa-x88eqSSuT5.0Ns6COsOaeg#4

I suspect (from the postings on Facebook by Stephen Little about generating tools with Claude) that Perplexity might not be the best coding minion.

I tested it out on 6.0.6 and it works. I just put in the Dashboard so it can be detached and float as needed.

I had created a note for the ToDo gramplet that I stored special letters for repeated use.

I had several other symbols saved and added them to the VK.

"©®×±÷—–…¼½⅓⅔¾⅛⅜⅝⅞†¥£€"

1 Like

Just looked at the German extended keyboard layout on Wikipedia:

I don’t have the slightest idea how to interpret this keyboard layout diagram!

Number Row (1-0, ß, ´):
¹ ! ±  |  " ²     |  § ³     |  $ {     |  % [     |  & ]     |  / {     |  ( [     |  ) ]     |  = }     |  ? \     |  ´ `
  
Shift Layer:   !     "     §     $     %     &     /     (     )     =     ?                
  
AltGr Layer: ±     ²     ³     {     [     ]     {     [     ]     }     \                
  
Letter AltGr (select): Q:@  W:€  E:¬  R:¦  T:¶  Z:↑  U:↓  I:←  O:→  P:´  Ü:+  +:~
                       A:#  S:ß  D:¤  F:[  G:]  H:\  J:>  K:|  L:¬  Ö:fd  Ä:mu  #:'
                      <^>   ¦    ~    µ    <    >    |                

Core umlauts (ä ö ü ß) appear directly on keys

P.S. I realize I can just copy the folder containing the files into (in my case) .gramps/gramps 52/plugins, and that worked fine. I was just wondering how to do it the other way.

1 Like

The other way is only worth the effort when you are sharing with a bunch of people.

The reason that I want to experiment is that it might be the 1st step towards a curated collection for a private LAN or Wifi… like in a classroom, reunion gathering or genealogical society meeting.

The Virtual Keyboard gramplet is now available through the Gramps 5.2 Addon Manager.


The Special keyboard is … chaotic. It could use some suggestions before we release to the broader 6.0 community.

2 Likes

Prepping 1.1.0 for release:

Virtual Keyboard Gramplet — Version 1.1.0

clipboarded from Virtual Keyboard and pasted here: §14¶5 This ⅞ of a ß test®⁂

What’s new

  • Added country-specific keyboard layouts (originally GB/US. now FR, DE)
  • Added AZERTY and QWERTZ keyboards
  • Added AltGr support where appropriate
  • Added Tab character key
  • Added flag buttons to switch layout sets

Improvements

  • Layout buttons now behave like radio buttons with an active indicator
  • “Special” characters layout is clearer and better organized (added @DaveSch suggestions)
  • UI behavior is more consistent across layout switches
  • Internal structure cleaned up for future extensibility

Removed / changed

  • Removed Insert button (clipboard-only behavior retained)
  • Single-letter keys remain untranslated; control labels are now translatable

Under the hood

  • Code formatting cleanup (Black-style)
  • Safer initialization and fewer edge-case crashes

Unless I’ve misunderstood the topic, I think it’s the other way around for comments: azerty for French and qwertp for German.

Yep. The AI keeps swapping those keyboard mappings back and forth. I am extracting both the fr and de layout sets as external files soon. So the AI will not have that latitude any longer.

1.2.0 version udpate submitted to the queue. A new CSV file format for external mapping and layouts has been added and documented… with a French AZERTY keyboard as a CSV sample. (English QWERTY, German QWERTZ, and French as built-in definitions.) In case of duplicate, the external definition wins and supersedes the hard-coded one.