Reputation: 1
So I'm creating a basic program that lets you play roulette for a Computer Science Class. The program is fully built, I just had a question regarding images in Python. Is is possible to have my program display an image when prompted to by an if statement? I'm fairly new to python, any help would be appreciated.
Upvotes: 0
Views: 105
Reputation: 51
from PIL import Image
image = Image.open('path_to_image')
image.load()
Here is a tutorial on how to use Pil(low), a Python Image Library: How to use Pillow
Edit: You are probably building a GUI for you game, so check out TKinter, it's Graphical User Interface Library, with this you can create the "windows" of your game and place images and buttons there.
Upvotes: 1
Reputation: 3587
Use Python Image Library(PIL), it's pretty easy and has tons of documentation.
Upvotes: 0