Well, this may not be the cleanest or most efficient code i ever wrote. But its working and it's got a gui 
Code:
#!/usr/bin/env python
import sys
import pygtk
pygtk.require('2.0')
import gtk
import gobject
class GOL:
def __init__(self, infile, gridsize):
self.gridsize = gridsize
self.grid = [[0 for i in range(self.gridsize)] for i in range(self.gridsize)]
start = open(infile, 'r')
for y in range(self.gridsize):
for x in range(self.gridsize):
s = start.read(1)
if not s:
break
self.grid[y][x] = int(s)
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_title('GOL')
self.window.connect('destroy', lambda w : gtk.main_quit())
self.da = gtk.DrawingArea()
self.da.set_size_request(4 * self.gridsize, 4 * self.gridsize)
self.window.add(self.da)
self.window.show_all()
self.da.connect("expose-event", self.draw_state)
self.pixmap = gtk.gdk.Pixmap(None, 4 * self.gridsize, 4 * self.gridsize, 24)
self.style = self.da.get_style()
self.gc = self.style.fg_gc[gtk.STATE_NORMAL]
self.black = self.gc.get_colormap().alloc_color(0, 0, 0)
self.white = self.gc.get_colormap().alloc_color(65535, 65535, 65535)
self.gc.set_rgb_bg_color(self.black)
self.gc.set_rgb_fg_color(self.white)
self.draw_state()
self.timeout_id = gobject.timeout_add(200, self.next_state)
def draw_state(self, widget = None, data = None):
self.gc.set_rgb_fg_color(self.black)
self.pixmap.draw_rectangle(self.gc, True, 0, 0, 4 * self.gridsize, 4 * self.gridsize)
self.gc.set_rgb_fg_color(self.white)
for y in range(self.gridsize):
for x in range(self.gridsize):
if self.grid[y][x]:
self.pixmap.draw_rectangle(self.gc, True, x * 4, y * 4, 4, 4)
self.da.window.draw_drawable(self.gc, self.pixmap, 0, 0, 0, 0, 4 * self.gridsize, 4 * self.gridsize)
def next_state(self):
newgrid = [[0 for i in range(self.gridsize)] for i in range(self.gridsize)]
max = self.gridsize - 1
for y in range(self.gridsize):
for x in range(self.gridsize):
around = 0
if x > 0 and self.grid[y][x - 1]: around += 1
if x < max and self.grid[y][x + 1]: around += 1
if y > 0 and self.grid[y - 1][x]: around += 1
if y < max and self.grid[y + 1][x]: around += 1
if x > 0 and y > 0 and self.grid[y - 1][x - 1]: around += 1
if x < max and y > 0 and self.grid[y - 1][x + 1]: around += 1
if x > 0 and y < max and self.grid[y + 1][x - 1]: around += 1
if x < max and y < max and self.grid[y + 1][x + 1]: around += 1
if around == 3:
newgrid[y][x] = 1
elif around == 2 and self.grid[y][x]:
newgrid[y][x] = 1
self.grid = newgrid
self.draw_state
self.da.queue_draw()
return True
def main(argv):
gol = GOL(argv[1], int(argv[2]))
gtk.main()
if __name__ == '__main__':
main(sys.argv)
Bookmarks