Problem with keyboard (touch screen) for android

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
Meg'
Regular
Posts: 151
Joined: Tue Sep 27, 2011 10:37 am
Projects: Anges Démoniaques, Gang
Location: France
Contact:

Problem with keyboard (touch screen) for android

#1 Post by Meg' » Fri May 12, 2017 5:34 am

Hi!

I tried to follow everything here ==>
viewtopic.php?f=51&t=25972&p=317807#p317807

But the image for the keys of the keyboard appeared under the empty keyboard:
https://www.dropbox.com/s/4yw37r3nv6u6u ... d.JPG?dl=0

So I decided to use another code but that line causes problem:

Code: Select all

                ui.textbutton('{size=+60}   {/size}', clicked=ui.returns(text_code))


It was supposed to change the size of all the buttons. Instead, the font just... Disappears...
https://www.dropbox.com/s/kj58x0ic4j3ka ... t.JPG?dl=0

When the code is:

Code: Select all

                ui.textbutton(text_code, clicked=ui.returns(text_code))


It works, however the text is way too small and I need it at size 60:
https://www.dropbox.com/s/buths4aja67c1 ... l.JPG?dl=0

Here is the full code:

Code: Select all

init python:
    text_list1=["A","Z","E","R","T","Y","U","I","O","P","0",
                      "Q","S","D","F","G","H","J","K","L","M","0",
                      "W","X","C","V","B","N","É","È","-","0"]
    text_list2=["a","z","e","r","t","y","u","i","o","p","0",
                      "q","s","d","f","g","h","j","k","l","m","0",
                      "w","x","c","v","b","n","é","è","-","0"]
    input_text = ''
    input_header = 'Name:'
    text_limit = 16
    text_list=text_list1
    text_group=1

################

label inputter:
    if text_group==1:
        $text_list=text_list1
    elif text_group==2:
        $text_list=text_list2
         
    $ ui.frame(xpos=0.5, ypos=0.3, xanchor=0.5, yanchor=0, xminimum=450)
    $ ui.vbox()
    $ ui.text(input_header+" "+input_text)

    $ ui.null(height=30)

    $ ui.hbox()

    $ ui.textbutton("VALIDER", clicked=ui.returns("Done"))
    $ui.textbutton("RETOUR", clicked=ui.returns("Backspace"))
    $ui.textbutton("EFFACER", clicked=ui.returns("Deleteall"))
    if text_group==1:
        $ ui.textbutton("MAJ", clicked=ui.returns("lowercase"))
    elif text_group==2:
        $ ui.textbutton("MIN", clicked=ui.returns("uppercase"))
    $ ui.close()

    $ ui.null(height=10)

    $ ui.hbox(xalign= 0.5)
    python:
        for text_code in text_list:
       
            if text_code=="0":
                ui.close()
                ui.hbox(xalign= 0.5)
            elif  len(input_text)<=text_limit-1:
                ui.textbutton(text_code, clicked=ui.returns(text_code))
           

    $ ui.close()
    $ ui.close()
    $ button_selection=ui.interact()
               
    if button_selection=="Backspace":
        $ input_text=input_text[:-1]
        jump inputter
    elif button_selection=="Deleteall":
        $ input_text=''
        jump inputter
    elif button_selection=="uppercase":
        $text_group=1
        jump inputter
    elif button_selection=="lowercase":
        $text_group=2
        jump inputter
    elif button_selection=="Done":
        return
    $ select_text=button_selection

    python:
        for text_code in text_list:
            if select_text==text_code:
                input_text += text_code
    jump inputter


Can someone help me solve this?

If you have tips to create a keyboard based only on imagebuttons, I'm also interested.

Thank you in advance!
Last edited by Meg' on Thu Jun 08, 2017 1:57 pm, edited 2 times in total.
Image

User avatar
Meg'
Regular
Posts: 151
Joined: Tue Sep 27, 2011 10:37 am
Projects: Anges Démoniaques, Gang
Location: France
Contact:

Re: Problem with keyboard (touch screen) for android

#2 Post by Meg' » Sun May 14, 2017 4:46 am

I found a solution by adding a style to the text and the text_button in the init here:

Code: Select all

init python:
    text_list1=["A","Z","E","R","T","Y","U","I","O","P","0",
                      "Q","S","D","F","G","H","J","K","L","M","0",
                      "W","X","C","V","B","N","É","È","-","0"]
    text_list2=["a","z","e","r","t","y","u","i","o","p","0",
                      "q","s","d","f","g","h","j","k","l","m","0",
                      "w","x","c","v","b","n","é","è","-","0"]
    input_text = ''
    input_header = 'Name:'
    text_limit = 16
    text_list=text_list1
    text_group=1

[b]    style.text.size = 50
    style.button_text.size = 50[/b]
Image

User avatar
PyTom
Ren'Py Creator
Posts: 14694
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Problem with keyboard (touch screen) for android [SOLVED

#3 Post by PyTom » Sun May 14, 2017 10:57 pm

This is also ancient code. Nowadays, you can just use renpy.input and the keyboard will show up. (You may have to tweak the input screen so it's on the top half of the screen, so the keyboard doesn't overlap it.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Code > Drama
https://www.patreon.com/renpytom

User avatar
Meg'
Regular
Posts: 151
Joined: Tue Sep 27, 2011 10:37 am
Projects: Anges Démoniaques, Gang
Location: France
Contact:

Re: Problem with keyboard (touch screen) for android [SOLVED

#4 Post by Meg' » Wed May 17, 2017 6:27 am

This is what I'm actually using.

I wanted to implement the keyboard without renpy.input because a few users couldn't see the keyboard when they had to enter their name (I think this has to do with an old version of android ==> 2.3 or 2.7). To solve that, I wanted to use text.input and not renpy.input.

When building the apk file and choosing which version of android I'm targeting, will that affect the keyboard showing up or not for users of android 2.3 and 2.7?
Image

User avatar
PyTom
Ren'Py Creator
Posts: 14694
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Problem with keyboard (touch screen) for android [SOLVED

#5 Post by PyTom » Thu May 18, 2017 1:53 am

I don't think it should. The input screen should trigger the os to display the keyboard. That should work on any device that has an onscreen keyboard. At the same time - 2.3 is 6 years old, no longer supported, and there isn't an android 2.7.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Code > Drama
https://www.patreon.com/renpytom

User avatar
Meg'
Regular
Posts: 151
Joined: Tue Sep 27, 2011 10:37 am
Projects: Anges Démoniaques, Gang
Location: France
Contact:

Re: Problem with keyboard (touch screen) for android [SOLVED

#6 Post by Meg' » Thu Jun 08, 2017 1:57 pm

Sorry to bug you again about this but it seems to happen on device that are more recent. The last person who reported it to me had android 5.0
Image

Post Reply

Who is online

Users browsing this forum: No registered users