Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.cmm.msu.su/hg/petri_dish/annotate/50d862c2c691/scale.py
Дата изменения: Unknown
Дата индексирования: Fri Feb 28 06:39:43 2014
Кодировка:
petri_dish: scale.py annotate

petri_dish

annotate scale.py @ 10:50d862c2c691

Now all initial widgets are diabled after submit button is pressed
author Yashina Ksenia <ksenia_yashina@kodomo.fbb.msu.ru>
date Wed, 08 Dec 2010 00:30:58 +0300
parents 31d64bb536aa
children 53672899af16
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@10 9 scl1.config(state=DISABLED)
ksenia_yashina@10 10 scl2.config(state=DISABLED)
ksenia_yashina@10 11 scl3.config(state=DISABLED)
ksenia_yashina@10 12 cb1.config(state=DISABLED)
ksenia_yashina@10 13 cb2.config(state=DISABLED)
ksenia_yashina@8 14
ksenia_yashina@8 15 init_frame=LabelFrame(root,text="Initial parameters")
ksenia_yashina@8 16 init_frame.grid(padx=15,pady=10)
ksenia_yashina@10 17 scl1 = Scale(init_frame,orient=HORIZONTAL,length=100,from_=1,\
ksenia_yashina@10 18 to=50,sliderlength=7,width=10)
ksenia_yashina@10 19 scl1.grid(row=0, column=0,padx=10,pady=5)
ksenia_yashina@10 20 lbl1 = Label(init_frame,text="number of cells",bg="white")
ksenia_yashina@10 21 lbl1.grid(row=0,column=1,padx=10)
ksenia_yashina@10 22 scl2 = Scale(init_frame,orient=HORIZONTAL,length=100,from_=20,\
ksenia_yashina@10 23 to=500,sliderlength=7,width=10)
ksenia_yashina@10 24 scl2.grid(row=1, column=0,padx=10,pady=5)
ksenia_yashina@10 25 lbl2 = Label(init_frame,text="diameter of Petri dish",bg="white")
ksenia_yashina@10 26 lbl2.grid(row=1,column=1,padx=10)
ksenia_yashina@10 27 scl3 = Scale(init_frame,orient=HORIZONTAL,length=100,from_=1,\
ksenia_yashina@10 28 to=30,sliderlength=7,width=10)
ksenia_yashina@10 29 scl3.grid(row=2, column=0,padx=10,pady=5)
ksenia_yashina@10 30 lbl3 = Label(init_frame,text="cells' lifetime",bg="white")
ksenia_yashina@10 31 lbl3.grid(row=2,column=1,padx=10)
ksenia_yashina@8 32 lbl_frame=LabelFrame(init_frame,text="Reproduction")
ksenia_yashina@8 33 lbl_frame.grid(row=4,column=0,columnspan=2,padx=15,pady=10)
ksenia_yashina@8 34 list=["Asexual","Sexual"]
ksenia_yashina@10 35 cb1 = Checkbutton(lbl_frame,text="Asexual")
ksenia_yashina@10 36 cb1.pack()
ksenia_yashina@10 37 cb2 = Checkbutton(lbl_frame,text="Sexual")
ksenia_yashina@10 38 cb2.pack()
ksenia_yashina@10 39
ksenia_yashina@8 40 submit=Button(root,text="Submit",width=25,command=sbmt)
ksenia_yashina@8 41 submit.grid(row=1,column=0,columnspan=2,pady=10)
ksenia_yashina@8 42
ksenia_yashina@8 43 chng_frame=LabelFrame(root,text="Changable parameters")
ksenia_yashina@8 44 chng_frame.grid(padx=15,pady=10)
ksenia_yashina@8 45 scl = Scale(chng_frame,orient=HORIZONTAL,length=100,from_=1,\
ksenia_yashina@8 46 to=100,sliderlength=7,width=10)
ksenia_yashina@8 47 scl.grid(row=0, column=0,padx=10,pady=5)
ksenia_yashina@8 48 lbl = Label(chng_frame,text="environment",bg="white")
ksenia_yashina@8 49 lbl.grid(row=0,column=1,padx=10)
ksenia_yashina@8 50 btn = Button(chng_frame,text="Add mutation",width=25)#,command=mutate)
ksenia_yashina@8 51 btn.grid(row=1,column=0,columnspan=2,pady=10)
ksenia_yashina@8 52
ksenia_yashina@8 53 diam=400
ksenia_yashina@8 54 c=Canvas(height=diam+20,width=diam+20,relief=RIDGE)
ksenia_yashina@8 55 dish=c.create_oval(10,10,diam+10,diam+10,fill="white")
ksenia_yashina@8 56 c.grid(row=0,column=2,rowspan=6,padx=50,pady=10)
ksenia_yashina@8 57 mainloop()