Skip to main content

A virtual keyboard for CustomTkinter, making it easy to enter text on a Raspberry Pi with a touch display.

Project description

CTkKeyboard

A virtual keyboard for CustomTkinter, making it easy to enter text on a Raspberry Pi with a touch display.

Features

  • QWERTZ and QWERTY Layouts: Supports both QWERTZ and QWERTY keyboard layouts for different user preferences.
  • Enhanced Focus: Ensures improved focus with a dedicated entry for better text input.
  • Touch-Friendly: Designed specifically for touch displays, perfect for Raspberry Pi projects.
  • Special keys: Ensure easy entry of numbers and special characters.
  • Open Source: Free to use and modify.

Installation

pip install CTkKeyboard

Example

import customtkinter as ctk
from CTk_Keyboard import keyboard

#Setup Ctk window
app = ctk.CTk()

app.title("CTkKeyboard_example")

ctk.set_appearance_mode("Dark")
ctk.set_default_color_theme("blue")

screen_width = app.winfo_screenwidth()
screen_height = app.winfo_screenheight()

#configure window size
window_width = screen_width // 2
window_height = screen_height // 2
app.geometry(f"{window_width}x{window_height}+{screen_width//4}+{screen_height//4}")

#Create entry to bind keyboard
entry = ctk.CTkEntry(app, placeholder_text="Entry",justify="center", font=("Arial", 32, "bold"))
entry.grid(row=3, column=3, padx=10, pady=10, sticky="nsew")

#Bind Keyboard on FocusIn event 
entry.bind("<FocusIn>", lambda e: keyboard(app,entry,"qwerty"))

app.mainloop()

Options

Option Description
Master CustomTkinter main window
Widget Entry widget to bind keyboard
Layout Layout to choose "QWERTZ" or "QWERTY"

Usage

To use CTkKeyboard in your project, follow these steps:

  • Bind the Keyboard: Bind the keyboard to the entry widget, and it should appear automatically when the entry widget is focused.

  • Run your code: Execute your code.

  • Focus entry: Tap into the entry and the Keyboard will appear.

  • Type your text: Type the word you want to insert. If you need to input special characters, press the "func" button.

  • Confirm entry: Hit the "ok" button to confirm the entry, and the keyboard should disappear.

Preview

Qwerty Upper-Case

Example_img

Qwerty Lower-case

Example_img_2

Special Keys

Example_img_3

Credits

Note: Parts of the code in this example are from CustomTkinter

If you find my code helpful and would like to support me, feel free to buy me a Ko-fi. However, if you don't want to, that's okay too!

I'm always open to feedback to improve this project further!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

CTkKeyboard-0.3.6.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

CTkKeyboard-0.3.6-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file CTkKeyboard-0.3.6.tar.gz.

File metadata

  • Download URL: CTkKeyboard-0.3.6.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.2

File hashes

Hashes for CTkKeyboard-0.3.6.tar.gz
Algorithm Hash digest
SHA256 a743adb03f1bf6e80e7e0c20d992b3bb50a70db1892246b788f7f749761842d6
MD5 d390b0cc520b48ae2717ffa83f5c9a84
BLAKE2b-256 c14da7d4c8c28b3d347809d09147d198e7955ead99f76459b4841da8ab83970c

See more details on using hashes here.

File details

Details for the file CTkKeyboard-0.3.6-py3-none-any.whl.

File metadata

  • Download URL: CTkKeyboard-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.2

File hashes

Hashes for CTkKeyboard-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 adf1fee744f9acae5d26361ec8432becdea9f1c6faf4d8ff699721542cd6936c
MD5 c3d350eb5359a0021e1d12a2c2b518c7
BLAKE2b-256 10d8c4dea69360b16bdb2428b85cc60f1597b2f6ab35d8c17359640cbd437b40

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page