tutorial.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # type: ignore
  2. """Welcome to Pynecone! This file outlines the steps to create a basic app."""
  3. from pcconfig import config
  4. import pynecone as pc
  5. docs_url = "https://pynecone.io/docs/getting-started/introduction"
  6. filename = f"{config.app_name}/{config.app_name}.py"
  7. class State(pc.State):
  8. """The app state."""
  9. pass
  10. def index() -> pc.Component:
  11. return pc.center(
  12. pc.vstack(
  13. pc.heading("Welcome to Pynecone!", font_size="2em"),
  14. pc.box("Get started by editing ", pc.code(filename, font_size="1em")),
  15. pc.link(
  16. "Check out our docs!",
  17. href=docs_url,
  18. border="0.1em solid",
  19. padding="0.5em",
  20. border_radius="0.5em",
  21. _hover={
  22. "color": "rgb(107,99,246)",
  23. },
  24. ),
  25. spacing="1.5em",
  26. font_size="2em",
  27. ),
  28. padding_top="10%",
  29. )
  30. # Add state and page to the app.
  31. app = pc.App(state=State)
  32. app.add_page(index)
  33. app.compile()