Public feed #724611

Untitled

public text v1 · immutable
Raw Edit
·published 2007-10-03 18:41 UTC
rendered paste body
from Tkinter import *

global e

def calc():
	i = int(str(e.get()))
	print 'Given %d:\n >' % (i),
	va = 4.0
	vb = 1.0
	vc = 1.0
	vd = 0.0
	
	for y in range(i):
		ve = float(va / vb)
		vd += vc * ve
		vc = vc * -1
		vb += 2
	print '%f' % (vd)
	
	
window = Tk()
lbl = Label(window, text='How many iterations?')
lbl.pack(side=TOP)
e = Entry(name='text')
e.pack(expand = YES, fill = BOTH)
b = Button(window, text='Calculate', command=calc)
b.pack(side=BOTTOM)
window.mainloop()