I'm looking for a simple way to rotate a shape in python, tkinter. The shape I'm rotating is a triangle (polygon) if it matters. Thanks in advance for all the help

cool thanks tonyjv that helps. Does anyone know a way to rotate anything other than polygons and lines... like say an image? again thanks in advance

The simplest way to rotate an image with the Tkinter GUI toolkit is to use the Python Image Library (PIL) rotate function.

Check:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
to download PIL versions for Python27 and Python32

A simple example ...

from PIL import Image

image = Image.open('Audi.jpg')

# rotate 270 degrees counter-clockwise
imRotate = image.rotate(270)
filename = "AudiRotated2.jpg"
imRotate.save(filename)

# a simple way to show the image file is to use module webbrowser
# which activates the default viewer associated with the image
# works with Windows and Linux
import webbrowser
webbrowser.open(filename)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.