class TryWindow(toga.App):
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.
"""
self.boxa = toga.Box()
self.main_box2 = toga.Box('box2',children=[self.boxa],style=Pack(direction='row'))
self.main_box = toga.Box('box',children=[self.main_box2])
self.button1 = toga.Button("Clicck", on_press = self.clickButton)#,style = Pack(direction=COLUMN,alignment=CENTER))
self.main_box.add(self.button1)
self.main_box.style.update(direction='row',alignment='center')
self.main_window = toga.MainWindow(title=self.name)
self.main_window.content = self.main_box
self.main_window.show()
def clickButton(self,event):
print ("succeded")
self.main_window.close()
def main():
return TryWindow()
I don't find anyway to make a button widget in the center of a window/mainwindow