Brython is coming to DroidScript! (build native Android Apps)

182 views
Skip to first unread message

Dave

unread,
Sep 15, 2023, 12:35:38 PM9/15/23
to brython
Hi Everyone,

My names David, and I'm the founder of droidscript.org, a not-for-profit organisation with the aim of making app development easy and fun for everyone, anywhere.

I'm please to announce that we've just added Python support to DroidScript, with the wonderful Brython doing it's magic for us under the hood :)

I hope you find this as exciting as we do, because this will allow thousands of coders, young and old, to easily create native Android apps directly on their phones and tablets using Python.  

I've already briefly spoken to Pierre about this work and he has kindly allowed me to post this announcement on the forum, so that I can let everyone know and also ask for help testing our latest alpha - which includes Brython/Python support.

This is what a simple (Android Native) Python app looks like in DroidScript - 

#Import the native app object.
from native import app

#Called when application is created.
def OnStart():

#Create a layout with objects vertically centered.
lay = app.CreateLayout( "linear", "VCenter,FillXY" )

#Add an image 20% of screen width.
img = app.AddImage( lay, "/Sys/Img/Hello.png", 0.2 )
#Add a button 30% of screen width.
btn = app.AddButton( lay, "Press Me", 0.3 )
btn.SetMargins( 0, 0.05, 0, 0 )
btn.SetOnTouch( btn_OnTouch )
#Add layout to app.
app.AddLayout( lay )
#Called when user touches our button.
def btn_OnTouch():

app.ShowPopup( "Hello World!" )
#Vibrate phone with a pattern (in milliseconds).
#pause,vibrate,pause,vibrate...
app.Vibrate( "0,100,30,100,50,300" )



This is what a simple multi-platform 'Hybrid' app looks like (will run on web)

#Import the hybrid ui object.
from hybrid import ui

#Called after app is started.
def OnStart() :

#Create a full-screen layout,
main = ui.addLayout( "main", "Linear", "Center", 1, 1 )
main.setChildMargins( 0, 0, 0, 0.1 )

#Add an app bar to top of screen.
apb = ui.addAppBar( main, "My App", "", 1 )

#Add a button and set a function to handle presses.
btn1 = ui.addButton( main, "Primary", "Contained,Primary" )
btn1.setOnTouch( btn1_onTouch )

#Handle button presses.
def btn1_onTouch( ev ) :
ui.alert( "button pressed" )


Those are very simple apps, but you have the 'full power' of the DroidScript native framework at you disposal and can use Camera, USB, Bluetooth Serial, BLE, WiFi, Accelerometer, GPS and much more... even NodeJS!

If you like to help us test the alpha version and give us feedback, then please join this Discord server - https://discord.gg/n9ATJDnY6d and see the 'forum-python' and 'forum-droidscript/V3' topics.

And/Or ask to join this Google group - https://groups.google.com/u/1/g/droidscriptbeta

Hopefully we will be releasing the first alpha this weekend :)

Comments on this forum are also welcome.

Thanks
David


Pierre Quentel

unread,
Sep 15, 2023, 4:09:33 PM9/15/23
to brython
Hi Dave,

Great news ! For those who don't know DroidScript, it has been downloaded 2 million times on GooglePlay, so including Brython is a major event for us. I will prioritize the work that might be required for the integration in the next weeks.

I have joined the Discord server and encourage Brython users to also join to be able to test the new release.

Thanks
Pierre

Dave

unread,
Oct 2, 2023, 9:59:38 AM10/2/23
to brython
For those that don't like being on the 'bleeding edge', there is a more stable beta version of DroidScript that will allow you to create apps using Python directly on your phone here - 


You just need to enable the 'experiments' option in the About box and restart the app to see the Python templates appear in the 'New' menu.

Dave

unread,
Feb 20, 2024, 10:41:57 AMFeb 20
to brython
Good news... we now have official Python support in DroidScript, including python samples in the documentation :)

Thanks to Brython, you can now build native Android apps directly on your phone using Python!

Please let us know what you think of our implementation and report any issues here - 

Or Discuss it here- 
Reply all
Reply to author
Forward
0 new messages