rev |
line source |
ksenia_yashina@8
|
1 from Tkinter import * |
ksenia_yashina@8
|
2 root = Tk() |
ksenia_yashina@8
|
3 root.title("Interface") |
ksenia_yashina@8
|
4 |
ksenia_yashina@8
|
5 #def mutate(): |
ksenia_yashina@8
|
6 |
ksenia_yashina@8
|
7 def sbmt(): |
ksenia_yashina@8
|
8 submit.config(state=DISABLED) |
ksenia_yashina@8
|
9 |
ksenia_yashina@8
|
10 init_frame=LabelFrame(root,text="Initial parameters") |
ksenia_yashina@8
|
11 init_frame.grid(padx=15,pady=10) |
ksenia_yashina@8
|
12 list=[("number of cells",1,50),("diameter of Petri dish",20,500), \ |
ksenia_yashina@8
|
13 ("cells' lifetime",1,30)] |
ksenia_yashina@8
|
14 rownum=0 |
ksenia_yashina@8
|
15 for item,l,m in list: |
ksenia_yashina@8
|
16 scl = Scale(init_frame,orient=HORIZONTAL,length=100,from_=l,\ |
ksenia_yashina@8
|
17 to=m,sliderlength=7,width=10) |
ksenia_yashina@8
|
18 scl.grid(row=rownum, column=0,padx=10,pady=5) |
ksenia_yashina@8
|
19 lbl = Label(init_frame,text=item,bg="white") |
ksenia_yashina@8
|
20 lbl.grid(row=rownum,column=1,padx=10) |
ksenia_yashina@8
|
21 rownum+=1 |
ksenia_yashina@8
|
22 lbl_frame=LabelFrame(init_frame,text="Reproduction") |
ksenia_yashina@8
|
23 lbl_frame.grid(row=4,column=0,columnspan=2,padx=15,pady=10) |
ksenia_yashina@8
|
24 list=["Asexual","Sexual"] |
ksenia_yashina@8
|
25 for item in list: |
ksenia_yashina@8
|
26 cb = Checkbutton(lbl_frame,text=item) |
ksenia_yashina@8
|
27 cb.pack() |
ksenia_yashina@8
|
28 |
ksenia_yashina@8
|
29 submit=Button(root,text="Submit",width=25,command=sbmt) |
ksenia_yashina@8
|
30 submit.grid(row=1,column=0,columnspan=2,pady=10) |
ksenia_yashina@8
|
31 |
ksenia_yashina@8
|
32 chng_frame=LabelFrame(root,text="Changable parameters") |
ksenia_yashina@8
|
33 chng_frame.grid(padx=15,pady=10) |
ksenia_yashina@8
|
34 scl = Scale(chng_frame,orient=HORIZONTAL,length=100,from_=1,\ |
ksenia_yashina@8
|
35 to=100,sliderlength=7,width=10) |
ksenia_yashina@8
|
36 scl.grid(row=0, column=0,padx=10,pady=5) |
ksenia_yashina@8
|
37 lbl = Label(chng_frame,text="environment",bg="white") |
ksenia_yashina@8
|
38 lbl.grid(row=0,column=1,padx=10) |
ksenia_yashina@8
|
39 btn = Button(chng_frame,text="Add mutation",width=25)#,command=mutate) |
ksenia_yashina@8
|
40 btn.grid(row=1,column=0,columnspan=2,pady=10) |
ksenia_yashina@8
|
41 |
ksenia_yashina@8
|
42 diam=400 |
ksenia_yashina@8
|
43 c=Canvas(height=diam+20,width=diam+20,relief=RIDGE) |
ksenia_yashina@8
|
44 dish=c.create_oval(10,10,diam+10,diam+10,fill="white") |
ksenia_yashina@8
|
45 c.grid(row=0,column=2,rowspan=6,padx=50,pady=10) |
ksenia_yashina@8
|
46 mainloop() |