vilcans / screenplain

Write your screenplay in plain text and run it through this program to make it look good
MIT License
164 stars 29 forks source link

how do i include this in my code? #72

Closed russellaugust closed 1 year ago

russellaugust commented 2 years ago

I've pip'd but I don't seem to be able to import this into my code. Is this command line only? I don't see any examples of this being used. Any help would be very appreciated!

vilcans commented 2 years ago

Screenplain was mainly designed as a CLI application, but you should be able to use it in your own code.

Check the file main.py for how the CLI program does it. It goes something like this:

from screenplain.parsers import fountain
screenplay = fountain.parse(input)   # where input is some kind of stream, e.g. an open file

# To convert it to pdf for example:
from screenplain.export.pdf import to_pdf
to_pdf(screenplay, "out.pdf")

Please let me know if this works, or doesn't. Better instructions would definitely be good.