Skip to content

Not running :( #2628

@stroundlunar-ai

Description

@stroundlunar-ai

Describe the bug

I can't run my code

Steps to reproduce

idk

Expected behavior

to run

Screenshots

No response

Environment

  • Operating System:
  • Python version:
  • Software versions:
    • Briefcase:
    • Toga:
    • ...

Logs


Additional context

here's my code:
import toga, faker
from toga.style.pack import COLUMN, ROW

class HelloWorld(toga.App):
def greeting(name):
if name:
return f"Hello, {name}"
else:
return "Hello, stranger"

def startup(self):
   main_box = toga.Box(direction=COLUMN)

   name_label = toga.Label(
       "Your name: ",
       margin=(0, 5),
   )
   self.name_input = toga.TextInput(flex=1)

   name_box = toga.Box(direction=ROW, margin=5)
   name_box.add(name_label)
   name_box.add(self.name_input)
   print(f"{self.name_input.value}")

   button = toga.Button(
       "Say Hello!",
       on_press=self.say_hello,
       margin=5,
   )

   main_box.add(name_box)
   main_box.add(button)

   self.main_window = toga.MainWindow(title=self.formal_name)
   self.main_window.content = main_box
   self.main_window.show()

async def say_hello(self, widget):
    fake = faker.Faker()
    await self.main_window.dialog(
    toga.InfoDialog(
        greeting(self.name_input.value),
        f"A message from {fake.name()}: {fake.text()}",
    )
)

def main():
return HelloWorld()

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting detailsMore details are needed before the issue can be triaged.bugA crash or error in behavior.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions