Keyboard on mobile device

Describe your feature request

When using tkinter or Easygui The user cannot type information in boxes as the keyboard doesn’t show up

What problem(s) would this feature solve?
Better use if guis by users aimer fir mobile phones

Explain what you were trying to do when you came across the problem leading to this feature request

Making a « what’s your name box In Easygui, the box appears but user cannot type name because iPhone keyboard does not show up

1 Like

Hi @FrankYates !
This isn’t a Replit problem. These modules’ textboxes aren’t optimised for mobile use, and are meant to be use on desktop, not a phone.
Hope this helps!

1 Like

Thanks very much for precise response!
Do you know a way to make a gui script on mobile devices using replit which would enable user to input data from keyboard?

Best

1 Like

Another solution is to create a virtual keyboard, not as nice as the native iPhone keyboard but does the job

import tkinter as tk


def press(key):
    if key == "Space":
        key = " "
    elif key == "Back":
        current_text = name_entry.get()
        name_entry.delete(0, tk.END)
        name_entry.insert(0, current_text[:-1])
        return
    elif key == "Enter":
        ask_name_and_greet()
        return
    current_text = name_entry.get()
    name_entry.delete(0, tk.END)
    name_entry.insert(0, current_text + key)


def ask_name_and_greet():
    name = name_entry.get()
    greeting_label.config(text=f"Hello, {name}!" if name else "No name entered.")


root = tk.Tk()
root.title("Greeting Application with Virtual Keyboard")

name_entry = tk.Entry(root, font=("Helvetica", 16))
name_entry.pack(pady=10)

greeting_label = tk.Label(root, text="Welcome!", font=("Helvetica", 16))
greeting_label.pack(pady=20)

keyboard_frame = tk.Frame(root)
keyboard_frame.pack(pady=10)

# Define keyboard layout
keys = [
    ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'],
    ['Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P'],
    ['A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Enter'],
    ['Z', 'X', 'C', 'V', 'B', 'N', 'M', ',', '.', 'Back'],
    ['Space'],
]

for row in keys:
    frame = tk.Frame(keyboard_frame)
    frame.pack(side=tk.TOP)
    for k in row:
        button = tk.Button(frame, text=k, command=lambda k=k: press(k), padx=3, pady=3)
        button.pack(side=tk.LEFT)
root.mainloop()
2 Likes

No, sorry. I’m not very good at tkinter. Couldn’t get the gist of it. Maybe someone else can help.
Sorry!
But a good workaround, though!

3 Likes