Results 1 to 1 of 1
This type of thing works in python
Code:
dict = {}
boxes = ["box1", "box2", "box3", "box4", "box5"]
for box in boxes:
print box, "give it an integer"
dict[box] = ...
- 11-13-2007 #1Linux Newbie
- Join Date
- Sep 2005
- Posts
- 140
python(tkinter) confusion
This type of thing works in python
This does notCode:dict = {} boxes = ["box1", "box2", "box3", "box4", "box5"] for box in boxes: print box, "give it an integer" dict[box] = input() print dict
How do you get useful values from the entry boxes. Maybe the whole concept is bad?Code:from Tkinter import * root = Tk() dict = {} row = 0 boxes = ["box1", "box2", "box3", "box4", "box5"] for box in boxes: lbl = Label(root, text = box) lbl.grid() entry = Entry(root, width=30) entry.grid(row= row+1, column= 0) row += 2 for box in boxes: dict[box] = entry def gcodeme(): print dict Button(root, text = "Make it so", command = gcodeme).grid(row = 17, column = 0) root.mainloop()WARNING: I may be telling you more than I know !


Reply With Quote