Ejemplo n.º 1
0
    def __init__(self, flex):
        """Initialize box."""
        super().__init__(style=Pack(direction=COLUMN, flex=flex))
        self.fitting_function_box = LineBox()
        self.fitting_function_box.add(toga.Label(text="Fitting function:"))
        self.fitting_function_selection = toga.Selection(
            on_select=self.load_select_fitting_function_name, )
        self.fitting_function_box.add(self.fitting_function_selection)
        self.fitting_function_syntax = toga.TextInput(
            readonly=True,
            style=Pack(flex=1,
                       padding_left=BIG_PADDING,
                       padding_right=BIG_PADDING),
        )
        self.fitting_function_box.add(self.fitting_function_syntax)
        self.load_module_button = toga.Button(label="Load module",
                                              on_press=self.load_module)
        self.fitting_function_box.add(self.load_module_button)
        self.add(self.fitting_function_box)

        self.polynomial_degree_title = toga.Label("Degree:")
        self.polynomial_degree_input = toga.NumberInput(
            min_value=1,
            max_value=5,
            default=1,
            on_change=lambda widget: self.set_polynomial_degree(),
        )

        self.update_fitting_function_options()
Ejemplo n.º 2
0
    def __init__(self, on_fitting_function_load):
        """Initialize box."""
        super().__init__()
        self.__fitting_function = None
        self.on_fitting_function_load = None
        self.__polynomial_is_set = False

        self.add(toga.Label(text="Fitting function:"))
        self.fitting_function_selection = toga.Selection(
            on_select=self.load_select_fitting_function_name,
        )
        self.fitting_function_syntax = toga.TextInput(
            readonly=True,
            style=Pack(flex=1, padding_left=BIG_PADDING, padding_right=BIG_PADDING),
        )
        self.add(self.fitting_function_selection, self.fitting_function_syntax)

        self.polynomial_degree_title = toga.Label("Degree:")
        self.polynomial_degree_input = toga.NumberInput(
            min_value=1,
            max_value=5,
            default=1,
            on_change=lambda widget: self.set_polynomial_degree(),
        )

        self.update_fitting_function_options()
        self.on_fitting_function_load = on_fitting_function_load
Ejemplo n.º 3
0
    def startup(self):
        # Set up main window
        self.main_window = toga.MainWindow(title=self.name)

        # Labels to show responses.
        self.label = toga.Label(
            'Enter some values and press extract.', style=Pack(padding=10)
        )
        self.text_label = toga.Label('Ready.', style=Pack(padding=10))
        self.password_label = toga.Label('Ready.', style=Pack(padding=10))
        self.password_content_label = toga.Label(
            EMPTY_PASSWORD, style=Pack(padding_bottom=10, font_size=9)
        )
        self.number_label = toga.Label('Ready.', style=Pack(padding=10))

        # Text inputs and a button
        self.text_input = toga.TextInput(
            placeholder='Type something...', style=Pack(padding=10)
        )
        self.password_input = toga.PasswordInput(
            placeholder='Password...',
            style=Pack(padding=10),
            on_change=self.on_password_change
        )
        self.number_input = toga.NumberInput(style=Pack(padding=10))
        btn_extract = toga.Button(
            'Extract values',
            on_press=self.do_extract_values,
            style=Pack(flex=1)
        )

        # Outermost box
        box = toga.Box(
            children=[
                self.label,
                self.text_input,
                self.password_input,
                self.password_content_label,
                self.number_input,
                self.text_label,
                self.password_label,
                self.number_label,
                btn_extract,
            ],
            style=Pack(
                flex=1,
                direction=COLUMN,
                padding=10,
            )
        )

        # Add the content on the main window
        self.main_window.content = box

        # Show the main window
        self.main_window.show()
Ejemplo n.º 4
0
    def startup(self):
        # CRIAR COMPONENTES
        form = toga.Box(style=Pack(direction=COLUMN, padding=5))

        self.divider = toga.Label(' ', style=Pack(padding=(0, 5)))

        self.lbl_A = toga.Label('A: ', style=Pack(padding=(0, 5)))
        self.input_A = toga.NumberInput(style=Pack(flex=1))

        self.lbl_B = toga.Label('B: ', style=Pack(padding=(0, 5)))
        self.input_B = toga.NumberInput(style=Pack(flex=1))

        self.lbl_C = toga.Label('C: ', style=Pack(padding=(0, 5)))
        self.input_C = toga.NumberInput(style=Pack(flex=1))

        self.lbl_X1 = toga.Label('X¹: ', style=Pack(padding=(0, 5)))
        self.input_X1 = toga.TextInput(style=Pack(flex=1), on_change=False, readonly=True)

        self.lbl_X2 = toga.Label('X²: ', style=Pack(padding=(0, 5)))
        self.input_X2 = toga.TextInput(style=Pack(flex=1), on_change=False, readonly=True)

        self.btnCalcular = toga.Button('Calcular', on_press=self.calcular, style=Pack(padding=(0,5)))

        # ADICIONA NO FORM
        form.add(self.lbl_A)
        form.add(self.input_A)
        form.add(self.lbl_B)
        form.add(self.input_B)
        form.add(self.lbl_C)
        form.add(self.input_C)

        form.add(self.divider)
        form.add(self.btnCalcular)
        form.add(self.divider)
        
        form.add(self.lbl_X1)
        form.add(self.input_X1)
        form.add(self.lbl_X2)
        form.add(self.input_X2)
        
        self.main_window = toga.MainWindow(title=self.formal_name)
        self.main_window.content = form
        self.main_window.show()
Ejemplo n.º 5
0
    def startup(self):
        """
        Construct and show the Toga application.

        Usually, you would add your application to a main content box.
        We then create a main window (with a name matching the app), and
        show the main window.
        """
        main_box = toga.Box(style=Pack(direction=COLUMN))

        message_label = toga.Label("Message to be placed on image: ",
                                   style=Pack(padding=(0, 5)))
        self.message_input = toga.TextInput(style=Pack(flex=1))

        message_box = toga.Box(style=Pack(direction=ROW, padding=5))
        message_box.add(message_label)
        message_box.add(self.message_input)

        # Whether text shadow should be added or not
        shadow_box = toga.Box(style=Pack(direction=ROW, padding=5))

        shadow_label = toga.Label("Add shadow to text ",
                                  style=Pack(padding=(5)))
        self.shadow_check = toga.Switch("", style=Pack(padding=5))

        shadow_box.add(shadow_label)
        shadow_box.add(self.shadow_check)
        main_box.add(shadow_box)

        noise_box = toga.Box(style=Pack(direction=ROW, padding=5))

        main_box.add(noise_box)

        # The amount of graphics to be overlaid on the image
        noise_modifier_label = toga.Label("Amount of background images ",
                                          style=Pack(padding=(20, 5)))

        self.noise_modifier = toga.NumberInput(min_value=0,
                                               max_value=4,
                                               default=2,
                                               style=Pack(padding=(20, 5)))

        noise_box.add(noise_modifier_label)
        noise_box.add(self.noise_modifier)

        self.main_window = toga.MainWindow(title=self.formal_name)

        submit_button = toga.Button("Submit!",
                                    on_press=self.submit,
                                    style=Pack(padding=5))
        main_box.add(message_box)
        main_box.add(submit_button)

        self.main_window.content = main_box
        self.main_window.show()
Ejemplo n.º 6
0
def build(app):
    box = toga.Box(style=CSS(flex=1, padding=20))
    number_input = toga.NumberInput(min_value=100, max_value=200, step=1)
    box.add(number_input)

    def set_range(widget):
        number_input.range = (0, 10)

    btn = toga.Button('Set Range', on_press=set_range, style=CSS())
    box.add(btn)

    def toggle_enabled(widget):
        number_input.enabled = not number_input.enabled

    toggle_btn = toga.Button('Toggle Enabled', on_press=toggle_enabled)
    box.add(toggle_btn)
    return box
Ejemplo n.º 7
0
 def make_shapes_box(self):
     self.shape_select = toga.Selection(
         items=['Cylinder', 'Cone', 'Duble Cone'],
         style=Pack(width=132),
         on_select = self.set_draw_shape,
     )
     self.shape_segments = toga.NumberInput(
         min_value=3, max_value=20,
         style=Pack(width=132),
         on_change = self.set_draw_shape,
     )
     return toga.Box(
         style=Pack(direction=COLUMN),
         children=[
             self.shape_select,
             self.shape_segments,
         ],
     )
Ejemplo n.º 8
0
def build(app):

    container = toga.OptionContainer()

    box1 = toga.Box()

    button = toga.Button('Hello world', on_press=button_handler)
    button.style.padding = 50
    button.style.flex = 1

    label = toga.NumberInput(min_value=10.5,
                             max_value=50.6,
                             on_change=lambda app: print(app.value))
    label.text = 'Hola Mundo'

    selection = toga.Selection(items=['Casella', 'Pedro Infante', 'Camilo'],
                               on_select=lambda app: print(app.value))
    selection.items = ['321', '123', '456', '654', '789', '987']

    box1.add(button)
    box1.add(label)
    box1.add(selection)

    box2 = toga.Box()

    image = toga.Image('../../static/images/tiberius.svg')
    imageview = toga.ImageView(image)

    slider = toga.Slider(range=(30, 50), on_slide=lambda app: print(app.value))

    box2.add(imageview)
    box2.add(slider)

    container.add('Window 1', box1)
    container.add('Window 2', box2)

    return container
Ejemplo n.º 9
0
    def startup(self):
        # Paths and files
        ospath = os.path.dirname(sys.argv[0])
        self.CONFIG_FILE = ospath + '\\config'

        # Constants
        self.CHECKUP_TIME = 20 * 60
        self.BREAK_TIME = 20

        # Activity box
        activity_box = toga.Box(
            style=Pack(direction=COLUMN, background_color='aqua'))

        self.timer_running = False

        title_label = toga.Label('Eye Help',
                                 style=Pack(padding_left=50,
                                            padding_right=50,
                                            padding_top=20,
                                            font_family='monospace',
                                            font_size=30,
                                            font_weight='bold'))

        instruction = 'Start and stop timer to track your screen use and eye blinks'

        instructions_box = MultilineLabel(instruction,
                                          box_style=Pack(direction=COLUMN,
                                                         padding_left=50,
                                                         padding_top=10),
                                          label_style=Pack(
                                              padding_bottom=10,
                                              font_family='monospace',
                                              font_size=12),
                                          char_line=35)

        self.start_button = toga.Button('Start Timer!',
                                        on_press=self.begin_timer,
                                        style=Pack(padding_left=50,
                                                   padding_right=50,
                                                   padding_top=20,
                                                   background_color='violet',
                                                   height=50,
                                                   font_family='monospace',
                                                   font_size=20))

        self.stop_button = toga.Button('Stop Timer!',
                                       on_press=self.stop_timer,
                                       style=Pack(padding_left=50,
                                                  padding_right=50,
                                                  padding_top=20,
                                                  padding_bottom=10,
                                                  background_color='violet',
                                                  height=50,
                                                  font_family='monospace',
                                                  font_size=20),
                                       enabled=False)

        # https://www.healthline.com/health/how-many-times-do-you-blink-a-day
        blinks_label = MultilineLabel(
            'It is recommended to blink 15 - 20 times in a minute',
            box_style=Pack(direction=COLUMN,
                           padding_bottom=10,
                           background_color='aqua'),
            label_style=Pack(padding_left=50,
                             background_color='aqua',
                             font_family='monospace',
                             font_size=12),
            char_line=35)

        activity_box.add(title_label)
        activity_box.add(self.start_button)
        activity_box.add(self.stop_button)
        activity_box.add(instructions_box)
        activity_box.add(blinks_label)

        # Eye tips box
        # https://www.mayoclinic.org/diseases-conditions/eyestrain/diagnosis-treatment/drc-20372403
        # https://www.health.ny.gov/prevention/tobacco_control/smoking_can_lead_to_vision_loss_or_blindness
        # https://www.health.harvard.edu/blog/will-blue-light-from-electronic-devices-increase-my-risk-of-macular-degeneration-and-blindness-2019040816365
        self.eye_tips = [
            'Try to not to use very bright lighting as the glare can strain your eyes and make the screen harder to look at',
            'Try to put light sources in places that do not directly shine on your eyes',
            'Using non-prescripted eye drops can help relieve dry eyes. Try to get ones recommended by your doctor',
            'Make sure you screens are at least an arms length away from your eyes',
            'Improve the air quality the air by getting a humidifier or adjusting the thermostat',
            'If you smoke, try to stop as it can lead to diseases related to vision loss',
            'Low levels of blue light (emitted froms screens and most lights) do not affect your eyes, but high levels can be hazardous to your eyes',
            'Blue light affects your biological clock (sleep cycle) so try to avoid screens and bright lights before or while you sleep',
            '20-20-20 Every 20 minutes focus at an object 20 feet far for at least 20 seconds',  # done by timer
            '...'
        ]

        eye_tips_box = toga.Box(style=Pack(
            direction=COLUMN, padding_bottom=10, background_color='aqua'))
        for tip in self.eye_tips:
            tip_box = MultilineLabel(tip,
                                     box_style=Pack(direction=COLUMN,
                                                    padding_bottom=10,
                                                    background_color='wheat'),
                                     label_style=Pack(background_color='aqua',
                                                      font_family='monospace',
                                                      font_size=15),
                                     char_line=28)
            eye_tips_box.add(tip_box)

        eye_tips_scroll = toga.ScrollContainer(style=Pack(
            direction=COLUMN, padding=(5, 5), background_color='red'))
        eye_tips_scroll.content = eye_tips_box

        # Calibrate box
        calibrate_box = toga.Box(
            style=Pack(direction=COLUMN, background_color='aqua'))
        calibrate_info = toga.Label('You will be given instructions',
                                    style=Pack(padding_left=10,
                                               padding_top=10,
                                               font_family='monospace',
                                               font_size=15))
        calibrate_button = toga.Button('Calibrate',
                                       style=Pack(padding_left=50,
                                                  padding_right=50,
                                                  padding_top=20,
                                                  padding_bottom=20,
                                                  background_color='violet',
                                                  font_family='monospace',
                                                  font_size=20),
                                       on_press=self.start_calibrate)
        calibrate_when = MultilineLabel(
            'Use this if you feel that blinks are not being counted correctly',
            box_style=Pack(direction=COLUMN,
                           padding_bottom=10,
                           background_color='aqua'),
            label_style=Pack(padding_left=10,
                             font_family='monospace',
                             font_size=15))
        graph_button = toga.Button('Graph Eye Aspect Ratio',
                                   style=Pack(padding_left=50,
                                              padding_right=50,
                                              padding_top=10,
                                              padding_bottom=10,
                                              background_color='violet',
                                              font_family='monospace',
                                              font_size=15),
                                   on_press=self.start_graph)

        EAR_definition = MultilineLabel(
            '*Eye aspect ratio is lower the more your eyes close',
            box_style=Pack(direction=COLUMN,
                           padding_bottom=10,
                           background_color='aqua'),
            label_style=Pack(padding_left=10,
                             font_family='monospace',
                             font_size=13))

        # manual calibration is a work in progress
        manual_label = toga.Label('Manually calibrate (pick EAR) here',
                                  style=Pack(padding_left=10,
                                             padding_top=10,
                                             font_family='monospace',
                                             font_size=15))
        manual_label2 = toga.Label('Pick a value that seems like a blink',
                                   style=Pack(padding_left=10,
                                              padding_top=10,
                                              font_family='monospace',
                                              font_size=15))
        manual_input = toga.NumberInput(min_value=1,
                                        max_value=99,
                                        style=Pack(padding=(10, 50), width=50))

        calibrate_box.add(calibrate_when)
        calibrate_box.add(calibrate_button)
        calibrate_box.add(calibrate_info)
        calibrate_box.add(graph_button)
        calibrate_box.add(EAR_definition)

        # Config box
        config_box = toga.Box(
            style=Pack(direction=COLUMN, background_color='aqua'))
        self.video_switch = toga.Switch('Show Video',
                                        style=Pack(padding_left=50,
                                                   padding_right=50,
                                                   padding_top=20,
                                                   padding_bottom=20,
                                                   font_family='monospace',
                                                   font_size=20),
                                        is_on=self.tobool(
                                            self.read_config()[1]))

        save_button = toga.Button('Save Configuration',
                                  style=Pack(padding_left=50,
                                             padding_right=50,
                                             padding_top=20,
                                             padding_bottom=20,
                                             background_color='violet',
                                             font_family='monospace',
                                             font_size=20),
                                  on_press=self.save_config)

        reset_button = toga.Button('Reset Configuration',
                                   style=Pack(padding_left=50,
                                              padding_right=50,
                                              padding_top=20,
                                              padding_bottom=20,
                                              background_color='red',
                                              font_family='monospace',
                                              font_size=20),
                                   on_press=self.reset_config)

        config_box.add(self.video_switch)
        config_box.add(save_button)
        config_box.add(reset_button)

        # options - toolbar
        options = toga.OptionContainer(style=Pack(direction=ROW,
                                                  background_color='snow',
                                                  font_family='monospace',
                                                  font_size=15))
        options.add('Activity', activity_box)
        options.add('Eye tips', eye_tips_scroll)
        options.add('Calibrate', calibrate_box)
        options.add('Configure', config_box)

        main_box = toga.Box(style=Pack(
            padding=(10, 10), direction=COLUMN, background_color='snow'))
        main_box.add(options)

        # Create and show main window
        self.main_window = toga.MainWindow(title=self.formal_name,
                                           size=(640, 480),
                                           resizeable=False)
        self.main_window.content = main_box
        self.main_window.show()
Ejemplo n.º 10
0
    def startup(self):
        # Set up main window
        self.main_window = toga.MainWindow(title=self.name, size=(750, 500))

        self.canvas = toga.Canvas(
            style=Pack(flex=1),
            on_resize=self.refresh_canvas,
            on_press=self.on_press,
            on_drag=self.on_drag,
            on_release=self.on_release,
            on_alt_press=self.on_alt_press,
            on_alt_drag=self.on_alt_drag,
            on_alt_release=self.on_alt_release
        )
        self.context_selection = toga.Selection(items=[STROKE, FILL], on_select=self.refresh_canvas)
        self.drawing_shape_instructions = {
            INSTRUCTIONS: self.draw_instructions,
            TRIANGLE: self.draw_triangle,
            TRIANGLES: self.draw_triangles,
            RECTANGLE: self.draw_rectangle,
            ELLIPSE: self.draw_ellipse,
            HALF_ELLIPSE: self.draw_half_ellipse,
            ICE_CREAM: self.draw_ice_cream,
            SMILE: self.draw_smile,
            SEA: self.draw_sea,
            STAR: self.draw_star,
        }
        self.dash_patterns = {
            CONTINUOUS: None,
            DASH_1_1: [1, 1],
            DASH_1_2: [1, 2],
            DASH_2_3_1: [2, 3, 1]
        }
        self.shape_selection = toga.Selection(
            items=list(self.drawing_shape_instructions.keys()),
            on_select=self.on_shape_change
        )
        self.color_selection = toga.Selection(
            items=[BLACK, BLUE, GREEN, RED, YELLOW],
            on_select=self.refresh_canvas
        )
        self.fill_rule_selection = toga.Selection(
            items=[value.name.lower() for value in FillRule],
            on_select=self.refresh_canvas
        )
        self.line_width_slider = toga.Slider(
            range=(1, 10),
            default=1,
            on_slide=self.refresh_canvas
        )
        self.dash_pattern_selection = toga.Selection(
            items=list(self.dash_patterns.keys()),
            on_select=self.refresh_canvas
        )
        self.clicked_point = None
        self.translation = None
        self.rotation = 0
        self.scale_x_slider = toga.Slider(
            range=(0, 2),
            default=1,
            tick_count=10,
            on_slide=self.refresh_canvas
        )
        self.scale_y_slider = toga.Slider(
            range=(0, 2),
            default=1,
            tick_count=10,
            on_slide=self.refresh_canvas
        )
        self.font_selection = toga.Selection(
            items=[
                SYSTEM,
                MESSAGE,
                SERIF,
                SANS_SERIF,
                CURSIVE,
                FANTASY,
                MONOSPACE
            ],
            on_select=self.refresh_canvas
        )
        self.font_size = toga.NumberInput(
            min_value=10,
            max_value=72,
            default=20,
            on_change=self.refresh_canvas
        )
        self.italic_switch = toga.Switch(
            label="italic",
            on_toggle=self.refresh_canvas
        )
        self.bold_switch = toga.Switch(
            label="bold",
            on_toggle=self.refresh_canvas
        )
        label_style = Pack(font_size=10, padding_left=5)

        # Add the content on the main window
        box = toga.Box(
            style=Pack(direction=COLUMN),
            children=[
                toga.Box(
                    style=Pack(direction=ROW, padding=5),
                    children=[
                        self.context_selection,
                        self.shape_selection,
                        self.color_selection,
                        self.fill_rule_selection
                    ]
                ),
                toga.Box(
                    style=Pack(direction=ROW, padding=5),
                    children=[
                        toga.Label("Line Width:", style=label_style),
                        self.line_width_slider,
                        self.dash_pattern_selection
                    ]
                ),
                toga.Box(
                    style=Pack(direction=ROW, padding=5),
                    children=[
                        toga.Label("X Scale:", style=label_style),
                        self.scale_x_slider,
                        toga.Label("Y Scale:", style=label_style),
                        self.scale_y_slider,
                        toga.Button(
                            label="Reset transform",
                            on_press=self.reset_transform
                        )
                    ]
                ),
                toga.Box(
                    style=Pack(direction=ROW, padding=5),
                    children=[
                        toga.Label("Font Family:", style=label_style),
                        self.font_selection,
                        toga.Label("Font Size:", style=label_style),
                        self.font_size,
                        self.bold_switch,
                        self.italic_switch
                    ]
                ),
                self.canvas
            ]
        )
        self.main_window.content = box

        self.change_shape()
        self.render_drawing()

        # Show the main window
        self.main_window.show()
Ejemplo n.º 11
0
 def test_default(self):
     value = 5
     nr_input = toga.NumberInput(default=value, factory=toga_dummy.factory)
     self.assertEqual(nr_input.value, value)
Ejemplo n.º 12
0
    def setUp(self):
        super().setUp()

        self.nr_input = toga.NumberInput(factory=toga_dummy.factory)
        self.non_int_value = 'a'
Ejemplo n.º 13
0
    def setUp(self):
        self.factory = MagicMock()
        self.factory.NumberInput = MagicMock(return_value=MagicMock(spec=toga_dummy.factory.NumberInput))

        self.nr_input = toga.NumberInput(factory=self.factory)
Ejemplo n.º 14
0
    def startup(self):
        self.main_window = toga.MainWindow(title=self.formal_name,
                                           size=(320, 568))

        box = toga.Box(style=Pack(direction=COLUMN, padding=5))

        local_box = toga.Box(
            style=Pack(padding=(20, 0, 5, 0), alignment=CENTER))
        local_box.add(
            toga.Label('Local Currency:',
                       style=Pack(
                           width=120,
                           padding_right=5,
                           font_family='Helvetica',
                           font_size=16,
                           font_weight=BOLD,
                           text_align=RIGHT,
                       )))

        self.local_currency = toga.Selection(
            items=[str(c) for c in CURRENCIES],
            on_select=self.on_select,
            style=Pack(flex=1))
        local_box.add(self.local_currency)

        box.add(local_box)

        self.amount = toga.NumberInput(on_change=self.on_change,
                                       min_value=0,
                                       step='0.01',
                                       style=Pack(font_family='Helvetica',
                                                  font_size=48,
                                                  text_align=RIGHT))
        box.add(self.amount)

        tip_box = toga.Box(style=Pack(padding_top=10))

        self.tip_rate = toga.Selection(items=["20%", "15%", "10%"],
                                       on_select=self.on_select,
                                       style=Pack(flex=1))
        tip_box.add(self.tip_rate)

        self.tip = toga.TextInput(readonly=True,
                                  style=Pack(flex=1,
                                             padding_left=5,
                                             text_align=RIGHT))
        tip_box.add(self.tip)

        self.tip_total = toga.TextInput(readonly=True,
                                        style=Pack(flex=1, text_align=RIGHT))
        tip_box.add(self.tip_total)

        box.add(tip_box)

        my_box = toga.Box(style=Pack(padding=(10, 0, 5, 0), alignment=CENTER))
        my_box.add(
            toga.Label('My Currency:',
                       style=Pack(width=120,
                                  padding_right=5,
                                  font_family='Helvetica',
                                  font_size=16,
                                  font_weight=BOLD,
                                  text_align=RIGHT)))

        self.my_currency = toga.Selection(items=[str(c) for c in CURRENCIES],
                                          on_select=self.on_select,
                                          style=Pack(flex=1))
        my_box.add(self.my_currency)

        box.add(my_box)

        self.my_amount = toga.TextInput(readonly=True,
                                        style=Pack(font_family='Helvetica',
                                                   font_size=48,
                                                   text_align=RIGHT))
        box.add(self.my_amount)

        my_tip_box = toga.Box(style=Pack(padding_top=10))

        self.my_tip_label = toga.Label('20%',
                                       style=Pack(flex=1,
                                                  padding_left=5,
                                                  text_align=RIGHT))
        my_tip_box.add(self.my_tip_label)

        self.my_tip = toga.TextInput(readonly=True,
                                     style=Pack(flex=1,
                                                padding_left=5,
                                                text_align=RIGHT))
        my_tip_box.add(self.my_tip)

        self.my_tip_total = toga.TextInput(readonly=True,
                                           style=Pack(flex=1,
                                                      text_align=RIGHT))
        my_tip_box.add(self.my_tip_total)

        box.add(my_tip_box)

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