Skip to content

Instantly share code, notes, and snippets.

@freakboy3742
Created November 22, 2016 10:52
Show Gist options
  • Save freakboy3742/9cb2f5f0c32c095801ebb67d7171af3a to your computer and use it in GitHub Desktop.
Save freakboy3742/9cb2f5f0c32c095801ebb67d7171af3a to your computer and use it in GitHub Desktop.
Toga for Django
import toga
def button_handler(widget):
print("Hello")
class Example(toga.App):
def startup(self):
self.main_window = toga.MainWindow(self.name)
self.main_window.app = self
box = toga.Box()
button = toga.Button('Hello world', on_press=button_handler)
button.style.set(margin=50)
box.add(button)
self.main_window.title = self.name
self.main_window.content = box
# Show the main window
self.main_window.show()
from django.conf.urls import url
from django.contrib import admin
from example import Example
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'', Example('Example App 1.0', 'org.beeware.example').urls)
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment