Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # modules today! 2.11.2022
- print("Welcome!")
- # NEW FILE
- from colorama import Fore, Back, Style
- print(Fore.LIGHTGREEN_EX + 'Different text color!')
- print(Back.LIGHTWHITE_EX + 'New background color too!')
- # reset all styles and colors to normal
- print(Style.RESET_ALL)
- print('..okay, back to normal.')
- # NEW FILE
- from colorama import Fore, Back, Style
- print(Fore.RED + 'Different text color!')
- print("STILL RED COLOR, YAY!")
- print(Back.LIGHTBLACK_EX + "Changed the background! BUT STILL RED TEXT!")
- # reset all styles and colors to normal
- print(Style.RESET_ALL)
- print('..okay, back to normal.')
- # NEW FILE
- from colorama import Fore, Back, Style
- # ask integer from user
- number = input("Give a number:\n")
- number = int(number)
- # green text if positive number, red text otherwise
- if number >= 0:
- print(Back.LIGHTGREEN_EX + Fore.BLACK + "Positive number!")
- else:
- print(Back.LIGHTRED_EX + Fore.BLACK + "Negative number...")
- # reset styles to normal
- print(Style.RESET_ALL + "THANK YOU!")
- # NEW FILE
- # install Pillow module first, then use PIL in code afterwards
- from PIL import Image, ImageDraw
- # create a new image, size is 100 x 30
- img = Image.new('RGB', (100, 30), color=(73, 109, 137))
- # create a drawing object
- d = ImageDraw.Draw(img)
- # use drawing object to draw text in the image
- d.text((10, 10), "Hello World", fill=(255, 255, 0))
- # save image to file
- img.save('pil_text.png')
Advertisement
Add Comment
Please, Sign In to add comment