tutorial.py 1.0 KB

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