< BeeWare

BeeWare tananyag

Szerző: Sallai András

Copyright © 2020, Sallai András

Licenc: CC BY-SA 4.0

Web: https://szit.hu

Helló Világ

import toga class SimpleWindow(toga.App): def startup(self): main_box = toga.Box() self.main_window = toga.MainWindow(title='Helló Világ') self.main_window.content = main_box self.main_window.show() def main(): return SimpleWindow()

Gomb

button = toga.Button( 'Say Hello!', on_press=self.say_hello, style=Pack(padding=5) )

Bevitel

self.name_input = toga.TextInput(style=Pack(flex=1))

Doboz

name_box = toga.Box(style=Pack(direction=ROW, padding=5))
self.name_input = toga.TextInput(style=Pack(flex=1)) name_box = toga.Box(style=Pack(direction=ROW, padding=5)) name_box.add(name_label) name_box.add(self.name_input)
import toga box_a = toga.Box('box_a') box_b = toga.Box('box_b) box = toga.Box('box', children=[box_a, box_b])