Saturday, July 23, 2011

exec can execute code! Cool.

I learned how to start a python program from inside the python interpreter using exec, and I tried opening up more than one program at a time. It worked!

>>> f=open('Gridtest.py')
>>> exec f

This is going to be cool, because I can easily start other programs from inside python!

Wednesday, July 20, 2011

I love the bluefish editor for javascript!

I found a great linux editor for java script, and it is called bluefish. I love it, and I just found it a few minutes ago.

Saturday, July 16, 2011

I love Tkinters grid manager!

I wrote a simple GUI, and used the grid manager to arrange the widgets. I think I am going to like it better than Tkinter's pack.

from Tkinter import *
#I love Tkinter's grid manager! This is a simple example.
root = Tk()

def startVirus():
    print('Erasing hard drive now.')

Label(root, text="First").grid(row=0)
Label(root, text="Second").grid(row=1)

ent = Entry(root)
ent2 = Entry(root)

ent.grid(row=0, column=1)
ent2.grid(row=1, column=1)

btn = Button(root,text='Start the Virus',command=startVirus)
btn.grid(row=3, column=1)
root.mainloop()

Sunday, July 3, 2011

This is my first pickle in python.

I learned how to pickle a list using the pickle module. This is a neat way to store lists, dictionaries, or just about any python object. This is better than storing in a text file because when you unpickle the data it is restored to its original data type.

Followers

Blog Archive

About Me

My photo
Biking helps me to cope with life.