Skip to content

Instantly share code, notes, and snippets.

@Dayof
Last active June 27, 2017 03:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dayof/b47a18325d7af75708d74fd0c569f0a2 to your computer and use it in GitHub Desktop.
Save Dayof/b47a18325d7af75708d74fd0c569f0a2 to your computer and use it in GitHub Desktop.
import toga
class StartApp(toga.App):
def startup(self):
self.main_window = toga.MainWindow(self.name, size=(200, 200))
self.main_window.app = self
self.h_button = toga.Button('Hide Stub',
on_press=self.callbackHideLabel)
self.s_button = toga.Button('Show Stub',
on_press=self.callbackShowLabel)
self.label_box = toga.Box()
self.label_stub = toga.Label('Stub')
self.label_box.add(self.label_stub)
self.outer_box = toga.Box()
self.outer_box.add(self.label_box)
self.outer_box.add(self.h_button)
self.outer_box.add(self.s_button)
self.main_window.content = self.outer_box
self.main_window.show()
def callbackHideLabel(self, button):
self.label_box.hide()
def callbackShowLabel(self, button):
self.label_box.show()
app = StartApp('Hide or Show a Box Widget', 'org.pybee.tests')
app.main_loop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment