Anonymous Anonymous - 8 months ago
984 0

Toga iOS positioning attempt

Python

tutorial.py

import toga
import toga.style
from toga.style import Pack
from toga.style.pack import COLUMN, ROW


class HelloWorld(toga.App):
    def startup(self):
        # Create a main window with a name matching the app
        self.main_window = toga.MainWindow(self.name)

        self.c_label = toga.Label('Celcius')
        self.c_label.style.font_size = 20
        self.c_label.style.alignment = 'left'
        c_box = toga.Box('c_box', children=[self.c_label])

        f_label = toga.Label('Fahrenheit')
        f_label.style.alignment = 'left'
        f_box = toga.Box('f_box', children=[f_label])

        box = toga.Box('box', children=[c_box,f_box])
        box.flex_direction='column'
        box.style.padding_top = 20
        f_box.style.background_color = '#ff0000'
        c_box.style.background_color = '#00ff00'

        self.main_window.content = box
        box.refresh_sublayouts()
        box.refresh()
        self.main_window.show()

def main():
    return HelloWorld("Hello World","com.idfusion.helloworld")
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download