Y
Y
YariKartoshe4ka2020-06-13 22:01:09
Python
YariKartoshe4ka, 2020-06-13 22:01:09

How to bring up the keyboard on android?

I am writing a pygame game for android. As you know, this framework does not provide ui, and you have to implement everything yourself. I needed an input that, when clicked, shows a custom keyboard and enters text. How can I call this keyboard through the android module or other modules?
I use rapt as pygame to android

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anonymous_HaCkEd, 2020-08-31
@YariKartoshe4ka

You need to call the function pygame.key.start_text_input()of the key module
Code example where the keyboard is called:

import pygame

pygame.init()
pygame.display.set_mode((600, 600))
clock = pygame.time.Clock()
FPS = 60

while 1:
    for i in pygame.event.get():
        if i.type == pygame.QUIT:
            exit()
        elif i.type == pygame.MOUSEBUTTONDOWN:
            if i.button == 1:
            #При нажатии кнопки мышки/пальцем по экрану вызывается клавиатура
                pygame.key.start_text_input()
    clock.tick(FPS)
    pygame.display.update()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question