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

Re: rotating canvas item (Tkinter) 80 80

You can multiply with suitable complex number http://effbot.org/zone/tkinter-complex-canvas.htm

Re: rotating canvas item (Tkinter) 80 80

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

Re: rotating canvas item (Tkinter) 80 80

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 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.