Page 1 of 1

Problem with keyboard (touch screen) for android

Posted: Fri May 12, 2017 5:34 am
by Meg'
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!

Re: Problem with keyboard (touch screen) for android

Posted: Sun May 14, 2017 4:46 am
by Meg'
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]

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

Posted: Sun May 14, 2017 10:57 pm
by PyTom
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.)

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

Posted: Wed May 17, 2017 6:27 am
by Meg'
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?

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

Posted: Thu May 18, 2017 1:53 am
by PyTom
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.

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

Posted: Thu Jun 08, 2017 1:57 pm
by Meg'
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