Skip to content

Instantly share code, notes, and snippets.

@paulproteus
Created May 11, 2020 02:34
Show Gist options
  • Save paulproteus/3aa211c9a2cf9e7e89f33c8d3446eeb2 to your computer and use it in GitHub Desktop.
Save paulproteus/3aa211c9a2cf9e7e89f33c8d3446eeb2 to your computer and use it in GitHub Desktop.
HelloWorld toga/beeware app on Android
"""
My first application
"""
import toga
from toga.constants import RIGHT
from toga.style import Pack
from toga.style.pack import COLUMN, ROW
class HelloWorld(toga.App):
def startup(self):
main_box = toga.Box(style=Pack(direction=COLUMN))
name_label = toga.Label(
'Your name: ',
style=Pack(padding=(0, 5))
)
self.name_input = toga.TextInput(style=Pack(flex=1))
main_box.add(name_label)
main_box.add(self.name_input)
button = toga.Button(
'Say Hello!',
on_press=self.say_hello,
style=Pack(flex=1)
)
print("HELLO BUTTON DO NOT GO AWAY", button)
main_box.add(button)
print("main_box added the button, so where did it go")
self.main_window = toga.MainWindow(title=self.formal_name)
self.main_window.content = main_box
self.main_window.show()
def say_hello(self, widget):
print("Hello", self.name_input.value)
print("Hello say_hello")
def main():
return HelloWorld()
@paulproteus
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment