actually you want

{{=A('click me', callback=URL('btnon'))}}

and when you click it called the URL via ajax.

On Thursday, 9 April 2015 12:18:35 UTC-5, Richard wrote:
>
> Yes, I use button back in time, but with bootstrap I usually do 
> A(I(_class='icon-something', CAT('  '), T('some text'), _href=URL('btnon'), 
> _class='btn btn-small')
>
> Now you have an A with the look of a button.
>
> Richard
>
> On Thu, Apr 9, 2015 at 12:45 PM, Derek <[email protected]> wrote:
>
>> Richard's answer should work, but I just wanted to add, if you put an 'a' 
>> link to /btnon it will also call your function.
>>
>>
>> On Thursday, April 9, 2015 at 6:32:21 AM UTC-7, DXX wrote:
>>>
>>> So im just starting with Python / Web2py .... i want to do a simple test 
>>> page to have a button to turn on a led on a RPi...
>>>
>>> the default.py looks like this 
>>>
>>> import RPi.GPIO as GPIO
>>>
>>> def index():
>>>     return dict(message="this is a test")
>>>
>>> def btnon():
>>>     GPIO.setmode(GPIO.BCM)
>>>     GPIO.setup(22, GPIO.OUT)
>>>     GPIO.output(22,GPIO.HIGH)
>>>
>>>
>>> What i would like to do is call that btnon on an event, like a click on 
>>> something to make it exectute the commands.... if this something i can do 
>>> on a simple way, if you can guide me, i will be greatly appreciated
>>>
>>>  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to