tingbot / tingbot-python

🔩 Python APIs to write apps for Tingbot
Other
18 stars 9 forks source link

Keyboard UI for Tingbot #25

Open kennysmed opened 8 years ago

kennysmed commented 8 years ago

Here are the designs for the keyboard:

01 Default view

02 - caps Caps

03 - numbers Numbers

04 - symbols Symbols

05 - colour variation example Colour Variation Example

06 - colour variation example Colour Variation Example

07 - colour variation example Colour Variation Example

instructions Instructions / Guide

01 02 03 04 05 06 Custom Icons (These may appear invisible on this page but i assure you there are there :) !)

Joe will follow up with the API

joerick commented 8 years ago

As for the API, I'm thinking a blocking function for really simple use, just like a raw_input() call-

def keyboard_prompt(initial='', prompt='', ok_button='OK', background_color='black', allow_empty=True):
    # implementation here
    pass

So programs can use it like

password = keyboard_prompt(prompt='Password', initial='qwerty123')

Full example app:

import tingbot
from tingbot import *

state = {}

@button.press('left')
def change_name():
    state['name'] = keyboard_prompt(state['name'], prompt='Name')

def loop():
    screen.fill(color='black')
    screen.text('Hello, %s!' % state['name'])

tingbot.run(loop)