In my app, users only enter numbers. Change keyboard to numeral-friendly?
apple, in its infinite wisdom, decided that ipad users don't need big number entry.
you can use
and you at least start on the number screen.
this works for ui.TextField and ui.TextView
Oh, for input(), try setting the Extended Keyboard With Numbers under Keyboard settings in pythonista. (gear menu from file manager)
thanks for this input... your last point, about setting "extended keyboard with numbers" , was exciting -- but then on my ipad, inside gear -> keyboard, there is no option for that. Tht seemed funny, so I googled it and I admit that I saw someone on Github (user zrzka) saying to someone else "We no longer have extended keyboard with numbers.... if we will be adding it back, I will then xxxxx." Bummer! If any other thoughts pop into mind, let me know :)
cvp last edited by cvp
Create a my_input.py with
import ui def my_input(title): tf = ui.TextField() tf.name = title tf.text = '' tf.keyboard_type = ui.KEYBOARD_DECIMAL_PAD def tf_action(sender): sender.close() tf.action = tf_action tf.present('sheet',hide_title_bar=False) tf.begin_editing() tf.wait_modal() return tf.text
And your daughter may use it with
from my_input import my_input x = my_input('test') print(x)
ok, extended keyboard maybe went away in ios10..
@cvp Heyyy! That is very appreciated! So you pretty much showed me that I can avoid being afraid of the "ui" stuff. :) Thanks! ... I was in a hurry, so I only did one fast test of your method, and it works, that is exciting. But, I need to learn more about this. Because, for example, I noticed that the input text label appears on the screen, but on the ipad I have to tap on the input label if I want the keyboard to appear. Do you know a way to tell the app to "focus" on that input element, so that the keyboard immediately appears?
(Maybe I will see this problem go away when I actually build this function into our app.)
Anyway, this is cool, thank you again!
is supposed to focus the textfield, however, you might need to add a small delay after presenting, before this approach works.
cvp last edited by
Great. huge thanks for this. Someday I will have all these methods in my mind and I can stop feeling "on the outer edges" of them...
now also, I see I didn't need any delay. the flaw was that somehow the code that I copied into my app was not the full code that appears above. what I have re-copied works great. thanks.
cvp last edited by
@estephan500 Mea culpa. I had put some code without the tf.begin_editing and some minutes after I have modified it to add this line...Thus, if you have copied just between both, you got the first code. Sorry
runjaj last edited by runjaj
I'm the guy who asked https://forum.omz-software.com/topic/4930/use-the-numeric-keyboard-easily
I have posted there how to change the type of keyboard using the UI Designer. It's super easy (once you know how to do it. I had to ask Ole).
I hope it helps.