PDA

View Full Version : pytgk and numbers


christooss
April 8th, 2008, 08:46 AM
I have writen program that calculates rent in our apartment(in python) but Im having problem porting it to pygtk.

I have writen funckiton

def callback_romies(self,widget,data):
rommies = []
entry_text1v1 = self.rommie1.get_text()
rommies.append(entry_text1v1)
print rommies

And it works flawlessly cause it gets text. Now I have column of gtk.entry fields that i will write number in too and than append it to different list.

if I use get_text() i will get [''1000' ,'1500'] when printing values of gtk.etnry fields but I want it to be [1000, 1500]

Any Ideas?

I looked thorugh Gtk.entry (http://www.pygtk.org/docs/pygtk/class-gtkentry.html#method-gtkentry--get-text) but I didn't find anything usefull.

tseliot
April 8th, 2008, 08:56 AM
try with:
rommies.append(int(entry_text1v1))

christooss
April 8th, 2008, 09:11 AM
numbers = map(int, mylist)

I did it with this code ^

I will use your suggestion too.

Thanks for the anwser