view scale.py @ 12:7408ce97c651
Converted class scale.IF to new-style
author |
Daniil Alexeyevsky <me.dendik@gmail.com> |
date |
Tue, 14 Dec 2010 14:50:55 +0300 |
parents |
53672899af16 |
children |
05518686d7af |
line source
6 def __init__(self,delay=10,diam=300,num=1,env=1,reprod_a=False,reprod_s=False,life=1):
11 self.reprod_s=reprod_s
12 self.reprod_a=reprod_a
16 return "<%s,%s,%s,%s,%s,%s,%s>"%(self.delay,self.diam,self.num,\
17 self.env,self.reprod_a,\
18 self.reprod_s,self.life)
22 submit.config(text="Stop",command=self.stop)
23 scl1.config(state=DISABLED)
24 scl2.config(state=DISABLED)
25 scl3.config(state=DISABLED)
26 cb1.config(state=DISABLED)
27 cb2.config(state=DISABLED)
31 c.config(height=self.diam+20,width=self.diam+20,bg="gray75")
32 filler=c.create_rectangle(0,0,self.diam+22,self.diam+22,fill="lightgrey")
33 c.grid(row=0,column=2,rowspan=6,padx=50,pady=10)
34 dish=c.create_oval(10,10,self.diam+10,self.diam+10,fill="white")
38 submit.config(text="Submit",command=self.sbmt)
39 scl1.config(state=NORMAL)
40 scl2.config(state=NORMAL)
41 scl3.config(state=NORMAL)
42 cb1.config(state=NORMAL)
43 cb2.config(state=NORMAL)
45 def new_reprod_a(self):
46 self.reprod_a=not(self.reprod_a)
49 def new_reprod_s(self):
50 self.reprod_s=not(self.reprod_s)
54 # root.after(self.delay,intf.depict())
57 root.title("Interface")
61 init_frame=LabelFrame(root,text="Initial parameters")
62 init_frame.grid(padx=15,pady=10)
63 scl1 = Scale(init_frame,orient=HORIZONTAL,length=100,from_=1,\
64 to=50,sliderlength=7,width=10)
65 scl1.grid(row=0, column=0,padx=10,pady=5)
66 lbl1 = Label(init_frame,text="number of cells",bg="white")
67 lbl1.grid(row=0,column=1,padx=10)
68 scl2 = Scale(init_frame,orient=HORIZONTAL,length=100,from_=100,\
69 to=500,sliderlength=7,width=10)
70 scl2.grid(row=1, column=0,padx=10,pady=5)
71 lbl2 = Label(init_frame,text="diameter of Petri dish",bg="white")
72 lbl2.grid(row=1,column=1,padx=10)
73 scl3 = Scale(init_frame,orient=HORIZONTAL,length=100,from_=1,\
74 to=30,sliderlength=7,width=10)
75 scl3.grid(row=2, column=0,padx=10,pady=5)
76 lbl3 = Label(init_frame,text="cells' lifetime",bg="white")
77 lbl3.grid(row=2,column=1,padx=10)
78 lbl_frame=LabelFrame(init_frame,text="Reproduction")
79 lbl_frame.grid(row=4,column=0,columnspan=2,padx=15,pady=10)
80 list=["Asexual","Sexual"]
81 cb1 = Checkbutton(lbl_frame,text="Asexual",command=intf.new_reprod_a)
83 cb2 = Checkbutton(lbl_frame,text="Sexual",command=intf.new_reprod_s)
86 submit=Button(root,text="Submit",width=25,command=intf.sbmt)
87 submit.grid(row=1,column=0,columnspan=2,pady=10)
89 chng_frame=LabelFrame(root,text="Changeable parameters")
90 chng_frame.grid(padx=15,pady=10)
91 scl = Scale(chng_frame,orient=HORIZONTAL,length=100,from_=1,\
92 to=100,sliderlength=7,width=10)
93 scl.grid(row=0, column=0,padx=10,pady=5)
94 lbl = Label(chng_frame,text="environment",bg="white")
95 lbl.grid(row=0,column=1,padx=10)
96 btn = Button(chng_frame,text="Add mutation",width=25)#,command=mutate)
97 btn.grid(row=1,column=0,columnspan=2,pady=10)
99 #root.after(intf.delay,intf.depict())