This is a personal record of my python programming experiences. It will allow me to see how I am progressing as I learn a new language.
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.
Wednesday, May 18, 2011
Javascript
I found a You tube video that teaches JavaScript, and I used nano to write my code with and Epiphany web browser. It was fun for me. It's not much, but it is a start.
Saturday, May 14, 2011
My first class that makes a GUI
#I wrote a class that can be used to create a GUI. It is a start.
from Tkinter import *
class aGUI:
def __init__(self):
def hello():
print('Hello')
root=Tk()
btn=Button(root,text='press this', command=hello)
btn.pack()
root.mainloop()
from Tkinter import *
class aGUI:
def __init__(self):
def hello():
print('Hello')
root=Tk()
btn=Button(root,text='press this', command=hello)
btn.pack()
root.mainloop()
Monday, May 9, 2011
Some code I wanted to save for work
import arcpy
from arcpy import env
#Search Cursor example
parnum = raw_input("Parcel ID ?")
env.workspace= "p:/MyData.gdb" #This tells it which GDB to work in.
for row in arcpy.SearchCursor("Owners"): #This tell it what feature class to look in.
if row.PID== parnum :
print "Parcel number: ",row.PID
print "Owner name: ",row.ONAME
print "Parcel address: ",row.PADDRESS
print "Deed book & page: ",row.DBOOKPAGE
Thursday, February 3, 2011
I created a new GUI for work.
I created a GUI to assist Public Works in calculating Protest Extents.
from Tkinter import *
def exclusion():
AreaOfSubject=float(AreaSubject.get())
AreaROWinBuffer=float(AreaROW.get())
GrossAcresArea=float(GrossAcres.get())
theProtestArea=float(ProtestArea.get())
NetAcres=float(GrossAcresArea-(AreaOfSubject+AreaROWinBuffer))
print("Total area of exclusions = %0.2f " % float(AreaOfSubject+AreaROWinBuffer))
print("Net Acres = %0.2f "%NetAcres)
print("Extent of Protest is %0.2f" %float(theProtestArea/NetAcres))
root=Tk()
Label(root,text="Gross acres including subject property and ROW").pack()
GrossAcres=Entry(root)
GrossAcres.pack()
Label(root,text="Area of Subject Property").pack()
AreaSubject=Entry(root)
AreaSubject.pack()
Label(root,text="Area of Street ROW").pack()
AreaROW=Entry(root)
AreaROW.pack()
Label(root,text="Area of Protesting Properties").pack()
ProtestArea=Entry(root)
ProtestArea.pack()
btn1=Button(root,text="Protest Extent",command=exclusion)
btn1.pack()
root.mainloop()
from Tkinter import *
def exclusion():
AreaOfSubject=float(AreaSubject.get())
AreaROWinBuffer=float(AreaROW.get())
GrossAcresArea=float(GrossAcres.get())
theProtestArea=float(ProtestArea.get())
NetAcres=float(GrossAcresArea-(AreaOfSubject+AreaROWinBuffer))
print("Total area of exclusions = %0.2f " % float(AreaOfSubject+AreaROWinBuffer))
print("Net Acres = %0.2f "%NetAcres)
print("Extent of Protest is %0.2f" %float(theProtestArea/NetAcres))
root=Tk()
Label(root,text="Gross acres including subject property and ROW").pack()
GrossAcres=Entry(root)
GrossAcres.pack()
Label(root,text="Area of Subject Property").pack()
AreaSubject=Entry(root)
AreaSubject.pack()
Label(root,text="Area of Street ROW").pack()
AreaROW=Entry(root)
AreaROW.pack()
Label(root,text="Area of Protesting Properties").pack()
ProtestArea=Entry(root)
ProtestArea.pack()
btn1=Button(root,text="Protest Extent",command=exclusion)
btn1.pack()
root.mainloop()
Monday, January 17, 2011
My laptop was stolen by a Burglar.
A Burglar broke into my house and stolen my laptop computer. So, I lost the gas mileage calculator I had written. For practice, I rewrote it (mostly) from memory. (I had to change all my passwords I have on the internet too. Bummer!)
Thursday, December 23, 2010
Simple image displayer
I created a very simple image displayer using python's canvas widget. It will only display gif files, so converted a jpeg image with gimp. I don't know how to make the image fit in the window yet, but I can adjust the canvas size, and what part of the photo is showing on the canvas.
Subscribe to:
Posts (Atom)
Followers
Blog Archive
- June (1)
- March (3)
- February (1)
- July (3)
- May (1)
- April (1)
- March (1)
- January (1)
- December (1)
- November (4)
- July (3)
- May (2)
- April (1)
- March (6)
- February (2)
- December (1)
- November (1)
- September (3)
- August (3)
- July (1)
- March (3)
- January (1)
- December (5)
- November (2)
- October (1)
- September (2)
- August (1)
- July (4)
- May (3)
- February (1)
- January (1)
- December (1)
- November (2)
- October (2)
- September (9)
- August (2)
- May (1)
- April (1)
- March (6)
- February (5)
- January (3)
- August (2)





