From 0e1ec706fb8e1b49e91a21c6bff3afde36e00ea8 Mon Sep 17 00:00:00 2001 From: Anders <62402921+AnderSchofield@users.noreply.github.com> Date: Wed, 2 Aug 2023 15:42:38 -0300 Subject: [PATCH] Update main.py --- main.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 15b7932..1fe65a0 100644 --- a/main.py +++ b/main.py @@ -6,9 +6,11 @@ from kivy.uix.label import Label from kivy.core.window import Window + class KvApp(App): + def build(self): - # Set the window size to 1200x800 pixels + """Build the root widget.""" Window.size = (1200, 800) self.root = BoxLayout(orientation='horizontal') @@ -24,13 +26,11 @@ def build(self): return self.root - -# ... in the KvViewerApp class ... - - def update(self, instance, value) + def update(self, instance, value): + """Update the KV display widget when the TextInput changes.""" self.root.remove_widget(self.kv_display) try: - # Use textwrap.dedent on value to remove any common leading whitespace + # Use textwrap.dedent on value to remove any indentation self.kv_display = Builder.load_string(textwrap.dedent(value)) self.kv_display.size_hint_x = 0.5 self.root.add_widget(self.kv_display) @@ -38,5 +38,6 @@ def update(self, instance, value) self.kv_display = Label(text=str(e), size_hint_x=0.5) self.root.add_widget(self.kv_display) + if __name__ == '__main__': KvApp().run()