+ 1

Making my own Keyboard

Share Anything Code Hi I want to make my own keyboard with special alphabeth for daily use just like gboard can someone tell me where to start and what to do?

27th Oct 2019, 5:45 PM
Rasim Özcan Öz
Rasim Özcan Öz - avatar
10 Antworten
+ 3
Use the 'pyautogui' module. It has got many functions to create a virtual keyboard. The following functions will help you: i) pyautogui.typewrite(<string>): Simulates the typing of a string character by character. If the cursor is focused on some text box the parameter you supplied will be typed there. The parameter can be a character too. Eg. pyautogui.typewrite('Hello world') ii)pyautogui.keyDown(<keyname>): It simulates the holding a key in lock position. Helpful in cases such as numlock, capslock, scrolllock. iii)pyautogui.keyUp(<keyname>):Releases the key that was hold down in the previous method. iv)pyautogui.press(<keyname>):It simulates a single keystroke. It does not holds the key in lock position. Useful for keys such as: F1-12, ctrl, bksp, pgdn, etc. v) pyautogui.hotkey(<key1>,<key2>): It simulates the pressing of a hotkey. Eg. pyautogui.hotkey('ctrl','c')
29th Oct 2019, 3:37 AM
Jalaj Kumar
Jalaj Kumar - avatar
+ 2
I don't know how to do it in java but if python is ok for you, then I can surely help you.
28th Oct 2019, 11:12 AM
Jalaj Kumar
Jalaj Kumar - avatar
+ 2
The UI is upto you and you can do something like: button.onclick = lambda: pyautogui.press(<name of the button>) (Syntax depends upon the GUI module you are using) pyautogui also gives you control over user's mouse but I'd recommend you to read the docs for that.
29th Oct 2019, 3:39 AM
Jalaj Kumar
Jalaj Kumar - avatar
+ 2
Thank you kind sir for help
29th Oct 2019, 5:29 AM
Rasim Özcan Öz
Rasim Özcan Öz - avatar
+ 2
Jalaj Kumar, can this (with Python) also be done in a way that it doesn't only work inside that Python-program, but for your whole PC while the program runs, as if to make some sort of override keyboard driver to use it in different applications?
29th Oct 2019, 7:36 AM
HonFu
HonFu - avatar
+ 2
HonFu Yes you can do that. When the program is running wherever the cursor is focused, it will type the text over there. Try this: import pyautogui as pg import time for i in range(10): pg.typewrite("Hello world") time.sleep(1) Run this code and as soon as it launches, open some application like notepad, word or any text editor. You'll find "Hello world" printed there 10 times.
29th Oct 2019, 7:42 AM
Jalaj Kumar
Jalaj Kumar - avatar
+ 2
HonFu I think that we can do something like detecting the pressed key and then using pyautogui to trigger some other key. Something like: import keyboard as kb import pyautogui as pg kb.on_press_key("a", lambda evt: pg.press("alt")) But there's a problem with this. The function triggered by default when you press that key (here, a) will also be performed along with the function we defined. That is, when you press 'a' on the keyboard, with the above program running, it will work as if you pressed 'a' and 'alt' both. And for Rasim Özcan Öz 's question about Android: I haven"t tried it on android.So, you got to try it out yourself.
31st Oct 2019, 9:20 AM
Jalaj Kumar
Jalaj Kumar - avatar
+ 1
How can I make it ?
28th Oct 2019, 6:24 PM
Rasim Özcan Öz
Rasim Özcan Öz - avatar
+ 1
Also does it work for android phones?
29th Oct 2019, 8:02 AM
Rasim Özcan Öz
Rasim Özcan Öz - avatar
0
Whooo, creepy! And wildly useful as well. 😁 Can you define and redefine all sorts of key combos, like giving the letter 'a' the role to open up a new level, like alt?
29th Oct 2019, 8:02 AM
HonFu
HonFu - avatar