Currently not working, I will update it when it is :)
#Create border and import Tkinter
from Tkinter import *
root = Tk()
canvas = Canvas(root, width=600, height=300)
canvas.pack()
canvas.create_rectangle(0,0,600,300,fill="red")
canvas.create_rectangle(25,25,575,275,fill="black")
#Import random and randomize alphabet
import random
a = [65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,89,90,91]
random.shuffle(a)
#Selection Sort alg
def selectionSort(a):
n = len(a)
moves = 0
for startIndex in xrange(n):
minIndex = startIndex
for i in xrange(startIndex, n):
if (a[*i] < a[minIndex]):
minIndex = i
#Logging it to Tkinter
a[startIndex], a[minIndex] = a[minIndex], a[startIndex]
b = [chr(x) for x in a]
canvas.create_text(100,150,text=b,fill="white",font="Helvetica 18 bold")
canvas.create_text(225,150,text="Moves:" + " " + str(moves + 1),font="Helvetica 18 bold")
moves += 1
selectionSort(a)
root.mainloop()
Edited 7/20/2015 01:29:39