Saturday, February 16, 2013

Python Tutorial


I'm taking a tutorial on python.  This lesson is showing how to  use the sys module. I am enjoying learning new things about python.

Friday, February 1, 2013

Arcmap program



#Written by Steve Atchison Jan 29 2013
def protestacres():
    totalacre=0.00
    for row in arcpy.SearchCursor("ROW & Protest Acres"):
        acres = row.getValue('ClippedAcres')
        totalacre=float(totalacre)+float(acres)
    print("Area of Protesting Properties = %.2f"  % totalacre)

    return totalacre
def grossacres(): #1000' Buffer acres
    for row in arcpy.SearchCursor("Gross acres including subject & ROW"):
        acres = row.getValue('ClippedAcres')
        print("Gross acres including Subject Property & ROW =  %.2f " %acres)
        return acres
def areasubject():
    for row in arcpy.SearchCursor("SubjectProperty"):
        subjectsqft = row.getValue('Shape_Area')
        subjectacres = float(subjectsqft/43560)
        print("Area of Subject Property is %.2f " % subjectacres)
        return subjectacres
def arearow():
    for row in arcpy.SearchCursor("ROW acres"):
        rowac = row.getValue('ClippedAcres')
        print("Area of Street ROW = %.2f " %rowac)
        return rowac
def extent_of_protest():

    netacreage = grossacres()-(areasubject()+arearow())
    print(protestacres()/float(netacreage))

extent_of_protest()
#SELECT THE PROTESTING PROPERTIES FIRST BEFORE RUNNING THIS PROGRAM!

Tuesday, December 25, 2012

#I wrote a simple python program that creates a database with sqlite3 and a GUI with Tkinter. #It won't be useful except as reference for me.

from Tkinter import *
import sqlite3

def makedatabase():
    conn=sqlite3.connect('mydb.db')
    cur=conn.cursor()
    cur.execute("CREATE TABLE IF NOT EXISTS atable(name string, phone string)")
    cur.execute("INSERT INTO atable VALUES('Stephany','123-1234')")
    thedata=cur.execute("SELECT * FROM atable")
    for line in thedata:
        print line[0]
        print line[1]
   
root=Tk()
btn=Button(root,text="Run ",command=makedatabase)
btn.pack()
root.mainloop()




Saturday, November 17, 2012

PHP, MySql

  I have installed MySQL on my netbook.  I know python can hook up to MySQL databases.   Also, I got PHP installed and I am begining to learn a little about that.  I got interested in databases when I started using python to create sqlite3 databases. Now I'm going to try using PHP to manipulate MySql databases.

Tuesday, September 11, 2012

A simple drawing program

#Written by Steve Atchison

from Tkinter import *
from turtle import *
left(90)

def secline():
    penup()
    fd(2640)
    right(90)
    fd(2640)
    pendown()
    pencolor('red')
    right(90)
    fd(2640)
    
def turn180deg():
  
    left(180)
      
def drawline():
    linelength =float(length.get())
    lineangle=float(angle.get())

    right(lineangle)
    fd(linelength/10.0)
    left(lineangle)

    length.delete(0,END)
    angle.delete(0,END)

def clearlines():
       clear()

root=Tk()
root.title("Line draw")
root.geometry('200x200')

lbl2=Label(root,text='Angle').pack()

angle=Entry(root)
angle.pack()
lbl1 =Label(root,text='Length').pack()

length=Entry(root)
length.pack()

btn1=Button(root,text='Draw',command=drawline)
btn1.pack()

btn2=Button(root,text='Clear',command=clearlines)
btn2.pack()

btn3=Button(root,text='rotate 180',command=turn180deg)
btn3.pack()

root.mainloop()

Monday, September 10, 2012

I am writing a program to draw parcels with. I might actually use it at work.

Saturday, September 8, 2012

A simple drawing program


from Tkinter import *
import turtle

root=Tk()
root.title('Steves drawing machine')

can= Canvas(root, width=400,height=300)
can.pack()

def clickhandler(x,y):
    t.goto(x,y)

t=turtle.RawTurtle(can)

screen=t.getscreen()
screen.setworldcoordinates(0,0,400,400)
screen.onclick(clickhandler)

root.mainloop()

Followers

Blog Archive

About Me

My photo
Biking helps me to cope with life.