Skip to content

Instantly share code, notes, and snippets.

@Ze1598
Last active June 1, 2020 19:23
Show Gist options
  • Save Ze1598/85b4e986bd123f17f1fd7944449b5c9b to your computer and use it in GitHub Desktop.
Save Ze1598/85b4e986bd123f17f1fd7944449b5c9b to your computer and use it in GitHub Desktop.
quotespy: advanced usage example
import quotespy.tweet_graphics.tweet_graphics as t
import os
# List of `tweet_info` dictionaries
USERNAME = "José Fernando Costa"
USERTAG = "@soulsinporto"
tweets = [
{
"tweet_name": "compare_to_others_sometimes",
"user_name": USERNAME,
"user_tag": USERTAG,
"user_pic": "",
"tweet_text": "Compare yourself to others once in a while (using a reasonable scale!). If you completely isolate yourself you will end up working aimlessly without ever knowing when it is enough or how much you've improved."
},
{
"tweet_name": "merit_in_positives",
"user_name": USERNAME,
"user_tag": USERTAG,
"user_pic": "",
"tweet_text": "There is merit in talking about the positive aspects of terrible situations. It helps those going through the experience to see a glimpse of light at the end of the tunnel and it may help others who go through the same experience in the future."
},
{
"tweet_name": "write_down_ideas",
"user_name": USERNAME,
"user_tag": USERTAG,
"user_pic": "",
"tweet_text": "Write down ideas that pop up in your head in a reliable place (note-taking app, physical notebook, etc.). We often come up with the ideas or inspiration we are looking for when we least expect it, but it's easy to let them escape."
}
]
# Directory in which to save graphics
PATH = "output"
# Create custom light and dark mode settings
s_light = {
"font_family": "arial.ttf",
"font_size_text": 80,
"font_size_header": 70,
"size": [1800, 1800],
"color_scheme": ["#ffffff", "#000000"],
"wrap_limit": 36,
"margin_bottom": 30
}
s_dark = {
"font_family": "arial.ttf",
"font_size_text": 80,
"font_size_header": 70,
"size": [1800, 1800],
"color_scheme": ["#000000", "#ffffff"],
"wrap_limit": 36,
"margin_bottom": 30
}
# Create a graphic for each `tweet_info` in the list
for tweet in tweets:
tweet_name = tweet["tweet_name"]
# Each tweet is stored in its own folder
tweet_path = os.path.join(PATH, tweet_name)
# Create the folder with a terminal command
os.system(f"mkdir {PATH}\\{tweet_name}")
# And each folder has light and dark mode versions of the tweet
t.create_tweet(tweet, s_light, save_dir=tweet_path)
tweet["tweet_name"] = tweet_name + "_DM"
t.create_tweet(tweet, s_dark, save_dir=tweet_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment