def createApp(win): # - Frame - Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE, text='tkRigidMotion', font=CTK.FRAMEFONT, takefocus=1) #BB = CTK.infoBulle(parent=Frame, text='Define block rigid motions.\nCtrl+c to close applet.', temps=0, btype=1) Frame.bind('<Control-c>', hideApp) Frame.bind('<ButtonRelease-3>', displayFrameMenu) Frame.bind('<Enter>', lambda event: Frame.focus_set()) Frame.columnconfigure(0, weight=0) Frame.columnconfigure(1, weight=1) Frame.columnconfigure(2, weight=0) WIDGETS['frame'] = Frame # - Frame menu - FrameMenu = TK.Menu(Frame, tearoff=0) FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp) CTK.addPinMenu(FrameMenu, 'tkRigidMotion') WIDGETS['frameMenu'] = FrameMenu # - VARS - # -0- motion name - V = TK.StringVar(win) V.set('New') VARS.append(V) #--------------------- # -- Motion strings -- #--------------------- # -1- tx - V = TK.StringVar(win) V.set('0') VARS.append(V) # -2- ty - V = TK.StringVar(win) V.set('0') VARS.append(V) # -3- tz - V = TK.StringVar(win) V.set('0') VARS.append(V) # -4- cx - V = TK.StringVar(win) V.set('0') VARS.append(V) # -5- cy - V = TK.StringVar(win) V.set('0') VARS.append(V) # -6- cz - V = TK.StringVar(win) V.set('0') VARS.append(V) # -7- ex - V = TK.StringVar(win) V.set('0') VARS.append(V) # -8- ey - V = TK.StringVar(win) V.set('0') VARS.append(V) # -9- ez - V = TK.StringVar(win) V.set('0') VARS.append(V) # -10- angle - V = TK.StringVar(win) V.set('0') VARS.append(V) # -11- motion type V = TK.StringVar(win) V.set('1:MotionStrings') VARS.append(V) #----------------------------- # -- Cassiopee Motion rotor -- #----------------------------- # -12- psi0 - V = TK.DoubleVar(win) V.set(0.) VARS.append(V) # -13- psi0_b - V = TK.DoubleVar(win) V.set(0.) VARS.append(V) # -14- alp_pnt - V = TK.StringVar(win) V.set('0.; 0.; 0.') VARS.append(V) # -15- alp_vct - V = TK.StringVar(win) V.set('0.; 1.; 0.') VARS.append(V) # -16- alp0 - V = TK.DoubleVar(win) V.set(0.) VARS.append(V) # -17- transl_speed - V = TK.StringVar(win) V.set('0.; 0.; 0.') VARS.append(V) # -18- rot_pnt - V = TK.StringVar(win) V.set('0.; 0.; 0.') VARS.append(V) # -19- rot_vct - V = TK.StringVar(win) V.set('0.; 0.; 1.') VARS.append(V) # -20- rot_omg - V = TK.DoubleVar(win) V.set(0.) VARS.append(V) # -21- del_pnt - V = TK.StringVar(win) V.set('0.; 0.; 0.') VARS.append(V) # -22- del_vct - V = TK.StringVar(win) V.set('0.; 0.; 1.') VARS.append(V) # -23- del0 - V = TK.DoubleVar(win) V.set(0.) VARS.append(V) # -24- delc - V = TK.StringVar(win) V.set('0.; 0.; 0.') VARS.append(V) # -25- dels - V = TK.StringVar(win) V.set('0.; 0.; 0.') VARS.append(V) # -26- bet_pnt - V = TK.StringVar(win) V.set('0.; 0.; 0.') VARS.append(V) # -27- bet_vct - V = TK.StringVar(win) V.set('0.; 0.; 1.') VARS.append(V) # -28- bet0 - V = TK.DoubleVar(win) V.set(0.) VARS.append(V) # -29- betc - V = TK.StringVar(win) V.set('0.; 0.; 0.') VARS.append(V) # -30- bets - V = TK.StringVar(win) V.set('0.; 0.; 0.') VARS.append(V) # -31- tet_pnt - V = TK.StringVar(win) V.set('0.; 0.; 0.') VARS.append(V) # -32- tet_vct - V = TK.StringVar(win) V.set('1.; 0.; 0.') VARS.append(V) # -33- tet0 - V = TK.DoubleVar(win) V.set(0.) VARS.append(V) # -34- tetc - V = TK.StringVar(win) V.set('0.') VARS.append(V) # -35- tets - V = TK.StringVar(win) V.set('0.') VARS.append(V) # -36- span_vct - V = TK.StringVar(win) V.set('1.; 0.; 0.') VARS.append(V) # -37- pre_lag_pnt - V = TK.StringVar(win) V.set('0.; 0.; 0.') VARS.append(V) # -38- pre_lag_vct - V = TK.StringVar(win) V.set('1.; 0.; 0.') VARS.append(V) # -39- pre_lag_ang - V = TK.DoubleVar(win) V.set(0.) VARS.append(V) # -40- pre_con_pnt - V = TK.StringVar(win) V.set('0.; 0.; 0.') VARS.append(V) # -41- pre_con_vct - V = TK.StringVar(win) V.set('1.; 0.; 0.') VARS.append(V) # -42- pre_con_ang - V = TK.DoubleVar(win) V.set(0.) VARS.append(V) #---------------------- # -- Constant motion -- #---------------------- # -43- transl_speed - V = TK.StringVar(win) V.set('0.; 0.; 0.') VARS.append(V) # -44- axis_pnt - V = TK.StringVar(win) V.set('0.; 0.; 0.') VARS.append(V) # -45- axis_vct - V = TK.StringVar(win) V.set('0.; 0.; 1.') VARS.append(V) # -46- omega - V = TK.DoubleVar(win) V.set(0.) VARS.append(V) # - Settings - B = TTK.OptionMenu(Frame, VARS[11], '1:MotionStrings', '2:KMotionRotor', '3:ConstantMotion', command=changeMotionType) B.grid(row=0, column=0, columnspan=3, sticky=TK.EW) B = TTK.Label(Frame, text="Name:") BB = CTK.infoBulle(parent=B, text='Name of motion.') B.grid(row=1, column=0, sticky=TK.EW) B = TTK.Entry(Frame, textvariable=VARS[0], background='White') B.grid(row=1, column=1, columnspan=2, sticky=TK.EW) # - Set/Get - B = TTK.Button(Frame, text="Get", command=getVars) B.grid(row=3, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Get motion from zone (if exists).') B = TTK.Button(Frame, text="Set", command=setVars) B.grid(row=3, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Set motion in zone.') B = TTK.Button(Frame, text="Reset", command=resetVars) B.grid(row=3, column=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Reset all to default.') # Frame pour chaque type de motion Frame1 = TTK.Frame(Frame, borderwidth=0) Frame1.columnconfigure(0, weight=0) Frame1.columnconfigure(1, weight=1) WIDGETS['frame1'] = Frame1 Frame2 = TTK.Frame(Frame, borderwidth=0) Frame2.columnconfigure(0, weight=0) Frame2.columnconfigure(1, weight=1) WIDGETS['frame2'] = Frame2 Frame3 = TTK.Frame(Frame, borderwidth=0) Frame3.columnconfigure(0, weight=0) Frame3.columnconfigure(1, weight=1) WIDGETS['frame3'] = Frame3 # - Motion Type1: motion strings - B = TTK.Label(Frame1, text="tx:") BB = CTK.infoBulle(parent=B, text='Translation of origin.\nCan depend on {t}.') B.grid(row=0, column=0, sticky=TK.EW) B = TTK.Entry(Frame1, textvariable=VARS[1], background='White') BB = CTK.infoBulle(parent=B, text='Translation of origin.\nCan depend on {t}.') B.grid(row=0, column=1, sticky=TK.EW) B.bind('<Return>', setVars1) B = TTK.Label(Frame1, text="ty:") BB = CTK.infoBulle(parent=B, text='Translation of origin.\nCan depend on {t}.') B.grid(row=1, column=0, sticky=TK.EW) B = TTK.Entry(Frame1, textvariable=VARS[2], background='White') BB = CTK.infoBulle(parent=B, text='Translation of origin.\nCan depend on {t}.') B.grid(row=1, column=1, sticky=TK.EW) B.bind('<Return>', setVars1) B = TTK.Label(Frame1, text="tz:") BB = CTK.infoBulle(parent=B, text='Translation of origin.\nCan depend on {t}.') B.grid(row=2, column=0, sticky=TK.EW) B = TTK.Entry(Frame1, textvariable=VARS[3], background='White') BB = CTK.infoBulle(parent=B, text='Translation of origin.\nCan depend on {t}.') B.grid(row=2, column=1, sticky=TK.EW) B.bind('<Return>', setVars1) B = TTK.Button(Frame1, text="Set", command=setTransOrigin) B.grid(row=1, column=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Set trans origin from mouse.') B = TTK.Label(Frame1, text="cx:") BB = CTK.infoBulle(parent=B, text='Center of rotation.\nCan depend on {t}.') B.grid(row=4, column=0, sticky=TK.EW) B = TTK.Entry(Frame1, textvariable=VARS[4], background='White') BB = CTK.infoBulle(parent=B, text='Center of rotation.\nCan depend on {t}.') B.grid(row=4, column=1, sticky=TK.EW) B.bind('<Return>', setVars1) B = TTK.Label(Frame1, text="cy:") BB = CTK.infoBulle(parent=B, text='Center of rotation.\nCan depend on {t}.') B.grid(row=5, column=0, sticky=TK.EW) B = TTK.Entry(Frame1, textvariable=VARS[5], background='White') BB = CTK.infoBulle(parent=B, text='Center of rotation.\nCan depend on {t}.') B.grid(row=5, column=1, sticky=TK.EW) B.bind('<Return>', setVars1) B = TTK.Label(Frame1, text="cz:") BB = CTK.infoBulle(parent=B, text='Center of rotation.\nCan depend on {t}.') B.grid(row=6, column=0, sticky=TK.EW) B = TTK.Entry(Frame1, textvariable=VARS[6], background='White') B.grid(row=6, column=1, sticky=TK.EW) B.bind('<Return>', setVars1) B = TTK.Button(Frame1, text="Set", command=setCenterRotation) B.grid(row=5, column=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Set rotation center from mouse.') B = TTK.Label(Frame1, text="ex:") BB = CTK.infoBulle(parent=B, text='Second rot axis point.\nCan depend on {t}.') B.grid(row=7, column=0, sticky=TK.EW) B = TTK.Entry(Frame1, textvariable=VARS[7], background='White') BB = CTK.infoBulle(parent=B, text='Second rot axis point.\nCan depend on {t}.') B.grid(row=7, column=1, sticky=TK.EW) B.bind('<Return>', setVars1) B = TTK.Label(Frame1, text="ey:") BB = CTK.infoBulle(parent=B, text='Second rot axis point.\nCan depend on {t}.') B.grid(row=8, column=0, sticky=TK.EW) B = TTK.Entry(Frame1, textvariable=VARS[8], background='White') BB = CTK.infoBulle(parent=B, text='Second rot axis point.\nCan depend on {t}.') B.grid(row=8, column=1, sticky=TK.EW) B.bind('<Return>', setVars1) B = TTK.Label(Frame1, text="ez:") BB = CTK.infoBulle(parent=B, text='Second rot axis point.\nCan depend on {t}.') B.grid(row=9, column=0, sticky=TK.EW) B = TTK.Entry(Frame1, textvariable=VARS[9], background='White') BB = CTK.infoBulle(parent=B, text='Second rot axis point.\nCan depend on {t}.') B.grid(row=9, column=1, sticky=TK.EW) B.bind('<Return>', setVars1) B = TTK.Button(Frame1, text="Set", command=set2Axis) B.grid(row=8, column=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Set rot axis from mouse.') B = TTK.Label(Frame1, text="angle:") BB = CTK.infoBulle(parent=B, text='Rotation angle.\Can depend on {t}. In degrees.') B.grid(row=10, column=0, sticky=TK.EW) B = TTK.Entry(Frame1, textvariable=VARS[10], background='White') BB = CTK.infoBulle(parent=B, text='Rotation angle.\Can depend on {t}. In degrees.') B.grid(row=10, column=1, sticky=TK.EW) B.bind('<Return>', setVars1) # - Motion Type2: KMotionRotor - B = TTK.Label(Frame2, text="transl_speed:") BB = CTK.infoBulle(parent=B, text='Translation speed and span_vect.') B.grid(row=0, column=0, sticky=TK.EW) B = TTK.Entry(Frame2, textvariable=VARS[17], background='White', width=10) BB = CTK.infoBulle(parent=B, text='transl_speed.') B.grid(row=0, column=1, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Entry(Frame2, textvariable=VARS[36], background='White', width=10) BB = CTK.infoBulle(parent=B, text='span vector.') B.grid(row=0, column=2, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Label(Frame2, text="psi0:") BB = CTK.infoBulle(parent=B, text='Azymuth at t=0.') B.grid(row=1, column=0, sticky=TK.EW) B = TTK.Entry(Frame2, textvariable=VARS[12], background='White', width=10) BB = CTK.infoBulle(parent=B, text='psi0. In degrees.') B.grid(row=1, column=1, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Entry(Frame2, textvariable=VARS[13], background='White', width=10) BB = CTK.infoBulle(parent=B, text='psi0_b. In degrees.') B.grid(row=1, column=2, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Label(Frame2, text="alp:") BB = CTK.infoBulle(parent=B, text='Shaft angle.') B.grid(row=2, column=0, sticky=TK.EW) B = TTK.Entry(Frame2, textvariable=VARS[14], background='White', width=10) BB = CTK.infoBulle(parent=B, text='alp_pnt.') B.grid(row=2, column=1, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Entry(Frame2, textvariable=VARS[15], background='White', width=10) BB = CTK.infoBulle(parent=B, text='alp_vct.') B.grid(row=2, column=2, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Entry(Frame2, textvariable=VARS[16], background='White', width=4) BB = CTK.infoBulle(parent=B, text='alp0. In degrees.') B.grid(row=2, column=3, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Label(Frame2, text="rot:") BB = CTK.infoBulle(parent=B, text='Rotation.') B.grid(row=3, column=0, sticky=TK.EW) B = TTK.Entry(Frame2, textvariable=VARS[18], background='White', width=10) BB = CTK.infoBulle(parent=B, text='rot_pnt.') B.grid(row=3, column=1, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Entry(Frame2, textvariable=VARS[19], background='White', width=10) BB = CTK.infoBulle(parent=B, text='rot_vct.') B.grid(row=3, column=2, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Entry(Frame2, textvariable=VARS[20], background='White', width=4) BB = CTK.infoBulle(parent=B, text='rot_omg. In rad/time unit.') B.grid(row=3, column=3, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Label(Frame2, text="del:") BB = CTK.infoBulle(parent=B, text='..') B.grid(row=4, column=0, sticky=TK.EW) B = TTK.Entry(Frame2, textvariable=VARS[21], background='White', width=10) BB = CTK.infoBulle(parent=B, text='del_pnt.') B.grid(row=4, column=1, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Entry(Frame2, textvariable=VARS[22], background='White', width=10) BB = CTK.infoBulle(parent=B, text='del_vct.') B.grid(row=4, column=2, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Entry(Frame2, textvariable=VARS[23], background='White', width=4) B.grid(row=4, column=3, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='del0. In degrees.') B.bind('<Return>', setVars2) B = TTK.Label(Frame2, text="delc,s:") BB = CTK.infoBulle(parent=B, text='del modes.') B.grid(row=5, column=0, sticky=TK.EW) B = TTK.Entry(Frame2, textvariable=VARS[24], background='White', width=10) BB = CTK.infoBulle(parent=B, text='delc.') B.grid(row=5, column=1, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Entry(Frame2, textvariable=VARS[25], background='White', width=10) BB = CTK.infoBulle(parent=B, text='dels.') B.grid(row=5, column=2, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Label(Frame2, text="bet:") BB = CTK.infoBulle(parent=B, text='..') B.grid(row=6, column=0, sticky=TK.EW) B = TTK.Entry(Frame2, textvariable=VARS[26], background='White', width=10) BB = CTK.infoBulle(parent=B, text='bet_pnt.') B.grid(row=6, column=1, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Entry(Frame2, textvariable=VARS[27], background='White', width=10) BB = CTK.infoBulle(parent=B, text='bet_vct.') B.grid(row=6, column=2, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Entry(Frame2, textvariable=VARS[28], background='White', width=4) B.grid(row=6, column=3, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='bet0. In degrees.') B.bind('<Return>', setVars2) B = TTK.Label(Frame2, text="betc,s:") BB = CTK.infoBulle(parent=B, text='bet modes.') B.grid(row=7, column=0, sticky=TK.EW) B = TTK.Entry(Frame2, textvariable=VARS[29], background='White', width=10) BB = CTK.infoBulle(parent=B, text='betc.') B.grid(row=7, column=1, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Entry(Frame2, textvariable=VARS[30], background='White', width=10) BB = CTK.infoBulle(parent=B, text='bets.') B.grid(row=7, column=2, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Label(Frame2, text="tet:") BB = CTK.infoBulle(parent=B, text='..') B.grid(row=8, column=0, sticky=TK.EW) B = TTK.Entry(Frame2, textvariable=VARS[31], background='White', width=10) BB = CTK.infoBulle(parent=B, text='tet_pnt.') B.grid(row=8, column=1, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Entry(Frame2, textvariable=VARS[32], background='White', width=10) BB = CTK.infoBulle(parent=B, text='tet_vct.') B.grid(row=8, column=2, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Entry(Frame2, textvariable=VARS[33], background='White', width=4) B.grid(row=8, column=3, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='tet0. In degrees.') B.bind('<Return>', setVars2) B = TTK.Label(Frame2, text="tetc,s:") BB = CTK.infoBulle(parent=B, text='tet modes.') B.grid(row=9, column=0, sticky=TK.EW) B = TTK.Entry(Frame2, textvariable=VARS[34], background='White', width=10) BB = CTK.infoBulle(parent=B, text='tetc.') B.grid(row=9, column=1, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Entry(Frame2, textvariable=VARS[35], background='White', width=10) BB = CTK.infoBulle(parent=B, text='tets.') B.grid(row=9, column=2, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Label(Frame2, text="pre_lag:") BB = CTK.infoBulle(parent=B, text='..') B.grid(row=10, column=0, sticky=TK.EW) B = TTK.Entry(Frame2, textvariable=VARS[37], background='White', width=10) BB = CTK.infoBulle(parent=B, text='pre_lag_pnt.') B.grid(row=10, column=1, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Entry(Frame2, textvariable=VARS[38], background='White', width=10) BB = CTK.infoBulle(parent=B, text='pre_lag_vct.') B.grid(row=10, column=2, sticky=TK.EW) B.bind('<Return>', setVars2) B = TTK.Entry(Frame2, textvariable=VARS[39], background='White', width=4) B.grid(row=10, column=3, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='pre_lag_ang. In degrees.') B.bind('<Return>', setVars2) B = TTK.Label(Frame2, text="pre_con:") BB = CTK.infoBulle(parent=B, text='..') B.grid(row=11, column=0, sticky=TK.EW) B = TK.Entry(Frame2, textvariable=VARS[40], background='White', width=10) BB = CTK.infoBulle(parent=B, text='pre_con_pnt.') B.grid(row=11, column=1, sticky=TK.EW) B.bind('<Return>', setVars2) B = TK.Entry(Frame2, textvariable=VARS[41], background='White', width=10) BB = CTK.infoBulle(parent=B, text='pre_con_vct.') B.grid(row=11, column=2, sticky=TK.EW) B.bind('<Return>', setVars2) B = TK.Entry(Frame2, textvariable=VARS[42], background='White', width=4) B.grid(row=11, column=3, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='pre_con_ang. In degrees.') B.bind('<Return>', setVars2) # - Motion Type3: ConstantMotion - B = TTK.Label(Frame3, text="transl_speed:") BB = CTK.infoBulle(parent=B, text='Translation speed.') B.grid(row=0, column=0, sticky=TK.EW) B = TTK.Entry(Frame3, textvariable=VARS[43], background='White') BB = CTK.infoBulle(parent=B, text='Translation speed.') B.grid(row=0, column=1, sticky=TK.EW) B.bind('<Return>', setVars3) B = TTK.Label(Frame3, text="axis_pnt:") BB = CTK.infoBulle(parent=B, text='Rotation center.') B.grid(row=1, column=0, sticky=TK.EW) B = TTK.Entry(Frame3, textvariable=VARS[44], background='White') BB = CTK.infoBulle(parent=B, text='Rotation center.') B.grid(row=1, column=1, sticky=TK.EW) B.bind('<Return>', setVars3) B = TTK.Label(Frame3, text="axis_vct:") BB = CTK.infoBulle(parent=B, text='Rotation axis.') B.grid(row=2, column=0, sticky=TK.EW) B = TTK.Entry(Frame3, textvariable=VARS[45], background='White') BB = CTK.infoBulle(parent=B, text='Rotation axis.') B.grid(row=2, column=1, sticky=TK.EW) B.bind('<Return>', setVars3) B = TTK.Label(Frame3, text="omega:") BB = CTK.infoBulle(parent=B, text='Rotation speed. In rad/time unit.') B.grid(row=3, column=0, sticky=TK.EW) B = TTK.Entry(Frame3, textvariable=VARS[46], background='White') BB = CTK.infoBulle(parent=B, text='Rotation speed. In rad/time unit.') B.grid(row=3, column=1, sticky=TK.EW) B.bind('<Return>', setVars3) changeMotionType()
def createApp(win): ttk = CTK.importTtk() # - Frame - Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE, text='tkFamily', font=CTK.FRAMEFONT, takefocus=1) #BB = CTK.infoBulle(parent=Frame, text='Create famlies of\nblocks or BCs.\nCtrl+c to close applet.', temps=0, btype=1) Frame.bind('<Control-c>', hideApp) Frame.bind('<ButtonRelease-3>', displayFrameMenu) Frame.bind('<Enter>', lambda event : Frame.focus_set()) Frame.columnconfigure(0, weight=1) Frame.columnconfigure(1, weight=4) WIDGETS['frame'] = Frame # - Frame menu - FrameMenu = TK.Menu(Frame, tearoff=0) FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp) CTK.addPinMenu(FrameMenu, 'tkFamily') WIDGETS['frameMenu'] = FrameMenu # - VARS - # -0- Nom de la FamilyZone (new) - V = TK.StringVar(win); V.set(''); VARS.append(V) # -1- Nom de la FamilyBC (new) - V = TK.StringVar(win); V.set(''); VARS.append(V) # -2- Nom de la famille zone pour le tag V = TK.StringVar(win); V.set(''); VARS.append(V) # - Create zone family name - B = TTK.Button(Frame, text="NewZoneFamily", command=createZoneFamily) B.grid(row=0, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Create a new zone family tag.') B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=15) BB = CTK.infoBulle(parent=B, text='Zone family name.') B.grid(row=0, column=1, sticky=TK.EW) B.bind('<Return>', createZoneFamily) # - Tag with zone family - B = TTK.Button(Frame, text="Tag zone", command=tagWithZoneFamily) B.grid(row=1, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Tag a zone with a zone family.') F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[2], '') B.grid(sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Family zone name.') F.bind('<Enter>', updateFamilyZoneNameList) F.grid(row=1, column=1, sticky=TK.EW) WIDGETS['zones'] = B else: B = ttk.Combobox(F, textvariable=VARS[2], values=[], state='readonly') B.grid(sticky=TK.EW) F.bind('<Enter>', updateFamilyZoneNameList2) F.grid(row=1, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Family zone name.') WIDGETS['zones'] = B # - Create BC family - B = TTK.Button(Frame, text="NewBCFamily", command=createBCFamily) B.grid(row=2, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Create a new BC family tag.') B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=15) BB = CTK.infoBulle(parent=B, text='BC family name.') B.grid(row=2, column=1, sticky=TK.EW) B.bind('<Return>', createBCFamily)
def createApp(win): ttk = CTK.importTtk() # - Frame - Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE, text='tkMeshInfo', font=CTK.FRAMEFONT, takefocus=1) #BB = CTK.infoBulle(parent=Frame, text='Display mesh informations.\nCtrl+c to close applet.', temps=0, btype=1) Frame.bind('<Control-c>', hideApp) Frame.bind('<ButtonRelease-3>', displayFrameMenu) Frame.bind('<Enter>', lambda event : Frame.focus_set()) Frame.columnconfigure(0, weight=1) Frame.columnconfigure(1, weight=2) WIDGETS['frame'] = Frame # - Frame menu - FrameMenu = TK.Menu(Frame, tearoff=0) FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp) CTK.addPinMenu(FrameMenu, 'tkMeshInfo') WIDGETS['frameMenu'] = FrameMenu #- VARS - # -0- Npts - V = TK.StringVar(win); V.set(''); VARS.append(V) # -1- Var min - V = TK.StringVar(win); V.set(''); VARS.append(V) # -2- Var max - V = TK.StringVar(win); V.set(''); VARS.append(V) # -3- Selected block name V = TK.StringVar(win); V.set(''); VARS.append(V) # -4- Selected block type V = TK.StringVar(win); V.set(''); VARS.append(V) # -5- Selected variable V = TK.StringVar(win); V.set('CoordinateX'); VARS.append(V) # -6- NCells - V = TK.StringVar(win); V.set(''); VARS.append(V) # -7- NFaces - V = TK.StringVar(win); V.set(''); VARS.append(V) # - selected block name - B = TTK.Entry(Frame, textvariable=VARS[3], background='White', width=15) B.grid(row=0, column=0, columnspan=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Currently selected zone name.') # - selected block type - B = TTK.Entry(Frame, textvariable=VARS[4], background='White') B.grid(row=0, column=1, columnspan=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Currently selected zone type.') # - Npts - B = TTK.Label(Frame, text="Npts") B.grid(row=1, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Number of points in selection.') B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=10) B.grid(row=1, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Number of points in selection.') # - Ncells - B = TTK.Label(Frame, text="NCells") B.grid(row=2, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Number of cells in selection.') B = TTK.Entry(Frame, textvariable=VARS[6], background='White', width=10) B.grid(row=2, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Number of cells in selection.') # - NFaces - B = TTK.Label(Frame, text="NFaces") B.grid(row=3, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Number of faces in selection.') B = TTK.Entry(Frame, textvariable=VARS[7], background='White', width=10) B.grid(row=3, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Number of faces in selection.') # - Variable - B = TTK.Label(Frame, text="Variable: ") B.grid(row=4, column=0, columnspan=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Selected var name.') F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[5], '') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList) F.grid(row=4, column=1, columnspan=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Selected var name.') WIDGETS['variable'] = B else: B = ttk.Combobox(F, textvariable=VARS[5], values=[], state='readonly') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList2) F.grid(row=4, column=1, columnspan=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Selected var name.') WIDGETS['variable'] = B # - Min de la variable - B = TTK.Label(Frame, text="Min:") B.grid(row=5, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Min of variable.') B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=10) B.grid(row=5, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Min of variable.') # - Max de la variable - B = TTK.Label(Frame, text="Max:") B.grid(row=6, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Max of variable.') B = TTK.Entry(Frame, textvariable=VARS[2], background='White', width=10) B.grid(row=6, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Max of variable.') # - update - B = TTK.Button(Frame, text="Update info", command=updateInfo) B.grid(row=7, column=0, columnspan=2, sticky=TK.EW)
def createApp(win): ttk = CTK.importTtk() # - Frame - Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE, text='tkBC', font=CTK.FRAMEFONT, takefocus=1) #BB = CTK.infoBulle(parent=Frame, text='Manage boundary conditions.\nCtrl+c to close applet.', btype=1) Frame.bind('<Control-c>', hideApp) Frame.bind('<ButtonRelease-3>', displayFrameMenu) Frame.bind('<Enter>', lambda event: Frame.focus_set()) Frame.columnconfigure(0, weight=1) Frame.columnconfigure(1, weight=4) WIDGETS['frame'] = Frame # - Frame menu - FrameMenu = TK.Menu(Frame, tearoff=0) FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp) FrameMenu.add_command(label='Save', command=saveApp) FrameMenu.add_command(label='Reset', command=resetApp) CTK.addPinMenu(FrameMenu, 'tkBC') WIDGETS['frameMenu'] = FrameMenu # - VARS - # - 0 - Type de BC - V = TK.StringVar(win) V.set('Mesh') VARS.append(V) # - 1 - Type de cas (2D/3D) - V = TK.StringVar(win) V.set('3D') VARS.append(V) # - 2 - tol pour ConnectMatch - V = TK.StringVar(win) V.set('1.e-6') VARS.append(V) if 'tkBCMatchTol' in CTK.PREFS: V.set(CTK.PREFS['tkBCMatchTol']) # - 3 - ratio pour ConnectNearMatch - V = TK.StringVar(win) V.set('2') VARS.append(V) # - 4 - Type de BC pour fillEmptyBCWith - V = TK.StringVar(win) V.set('BCWall') VARS.append(V) # - 5 - Type de BC pour rmBCOfType - V = TK.StringVar(win) V.set('-All BC-') VARS.append(V) # - 6 - Type de BC pour setBCWith - V = TK.StringVar(win) V.set('BCWall') VARS.append(V) # - 7 - Edges des zones du calcul V = TK.StringVar(win) V.set('0') VARS.append(V) if 'tkBCEdges' in CTK.PREFS: V.set(CTK.PREFS['tkBCEdges']) # -8- SplitFactor info bulle V = TK.StringVar(win) V.set( 'Split more or less undefined BCs. \nUsefull only for unstructured grids.' ) VARS.append(V) # -9- Periodicity? in connectMatch V = TK.StringVar(win) V.set('Not periodic') VARS.append(V) # -10- Periodicity field (0;0;0...) V = TK.StringVar(win) V.set('0;0;0;0;0;0') VARS.append(V) if 'tkBCMatchPer' in CTK.PREFS: V.set(CTK.PREFS['tkBCMatchPer']) # - View mesh - B = TTK.Button(Frame, text="View Mesh", command=viewMesh) B.grid(row=0, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='View mesh.\nTree is NOT modified.') # - Edges - B = TTK.Checkbutton(Frame, text='Edges', variable=VARS[7]) BB = CTK.infoBulle(parent=B, text='Show edges of zones of the tree.') B.grid(row=0, column=1, sticky=TK.EW) # - View type de BC - B = TTK.Button(Frame, text="View BC", command=view) B.grid(row=1, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='View specified BC.\nTree is NOT modified.') # - Type of BC - ListBox Frame - LBFrame = TTK.Frame(Frame) LBFrame.grid(row=1, column=1, rowspan=4, sticky=TK.EW) LBFrame.rowconfigure(0, weight=1) LBFrame.columnconfigure(0, weight=1) LBFrame.columnconfigure(1, weight=0) SB = TTK.Scrollbar(LBFrame) LB = TTK.Listbox(LBFrame, selectmode=TK.EXTENDED, height=6) LB.bind('<Double-1>', view) LB.bind('<Enter>', updateBCNameList) # LB.bind('<ButtonRelease-1>', view) for i, value in enumerate(['-All BC-'] + getAllDefinedBC(CTK.t)): LB.insert(i, value) SB.config(command=LB.yview) LB.config(yscrollcommand=SB.set) LB.grid(row=0, column=0, sticky=TK.NSEW) SB.grid(row=0, column=1, sticky=TK.NSEW) LBFrame.bind('<Enter>', updateFamilyBCNameList1_2) WIDGETS['BCLB'] = LB # - View undefined BCs - B = TTK.Button(Frame, text="View undefined BC", command=displayUndefinedBoundaries) B.grid(row=2, column=0, columnspan=1, sticky=TK.EW) WIDGETS['undefinedBC'] = B BB = CTK.infoBulle( parent=B, text='View undefined BC in ALL tree.\nUse this to setBC or fillEmptyBC.' ) # - Slider for splitFactor - B = TTK.Scale(Frame, from_=0, to=100, orient=TK.HORIZONTAL, command=setSplitFactor, showvalue=0, borderwidth=1, value=0) WIDGETS['splitFactor'] = B B.grid(row=3, columnspan=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, textVariable=VARS[8]) # - rmBCOfType - B = TTK.Button(Frame, text="rm BC", command=rmBCOfType) B.grid(row=4, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Remove the BCs of given type from tree.') # - setBCWith - B = TTK.Button(Frame, text="setBCWith", command=setBCWith) B.grid(row=5, column=0, sticky=TK.EW) BB = CTK.infoBulle( parent=B, text='Set the BC with specified type.\nAdded to pyTree.') F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[6], *(Internal.KNOWNBCS)) B.grid(sticky=TK.EW) F.bind('<Enter>', updateFamilyBCNameList3) F.grid(row=6, column=1, sticky=TK.EW) WIDGETS['BCs2'] = B else: B = ttk.Combobox(F, textvariable=VARS[6], values=Internal.KNOWNBCS, state='readonly', width=10) B.grid(sticky=TK.EW) F.bind('<Enter>', updateFamilyBCNameList3_2) F.grid(row=5, column=1, sticky=TK.EW) WIDGETS['BCs2'] = B # - FillEmptyBCWith - B = TTK.Button(Frame, text="FillEmptyBCWith", command=fillEmptyBCWith) B.grid(row=6, column=0, sticky=TK.EW) BB = CTK.infoBulle( parent=B, text='Fill empty BCs with given type.\nAdded to pyTree.') F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[4], *(Internal.KNOWNBCS)) B.grid(sticky=TK.EW) F.bind('<Enter>', updateFamilyBCNameList4) F.grid(row=6, column=1, sticky=TK.EW) WIDGETS['BCs4'] = B else: B = ttk.Combobox(F, textvariable=VARS[4], values=Internal.KNOWNBCS, state='readonly', width=10) B.grid(sticky=TK.EW) F.bind('<Enter>', updateFamilyBCNameList4_2) F.grid(row=6, column=1, sticky=TK.EW) WIDGETS['BCs4'] = B # - setDegeneratedBC - B = TTK.Button(Frame, text="SetDegeneratedBC", command=setDegeneratedBC) B.grid(row=7, column=0, columnspan=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Find the degenerated BCs\nAdded to pyTree.') # - ConnectMatch - B = TTK.Button(Frame, text="ConnectMatch", command=connectMatch) B.grid(row=8, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Find the matching BCs\nAdded to pyTree.') B = TTK.Entry(Frame, textvariable=VARS[2], background='White') B.grid(row=8, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Tolerance for matching.') # - Periodicity management - B = TTK.OptionMenu(Frame, VARS[9], 'Not periodic', 'Translation', 'Rotation (Degree)') B.grid(row=9, column=0, sticky=TK.EW) B = TTK.Entry(Frame, textvariable=VARS[10], background='White') B.grid(row=9, column=1, sticky=TK.EW) BB = CTK.infoBulle( parent=B, text= 'Periodic translation: tx;ty;tz\nPeriodic rotation: cx;cy;cz;ax;ay;az\nangles in degrees.' ) # - ConnectNearMatch - B = TTK.Button(Frame, text="ConnectNearMatch", command=connectNearMatch) B.grid(row=10, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Find the matching BCs\nAdded to pyTree.') B = TTK.Entry(Frame, textvariable=VARS[3], background='White') B.grid(row=10, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Nearmatch ratio (2 or 2;1;2).')
def createApp(win): ttk = CTK.importTtk() # - Frame - Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE, text='tkPrefs', font=CTK.FRAMEFONT, takefocus=1) #BB = CTK.infoBulle(parent=Frame, text='Set Cassiopee preferences.\nCtrl+c to close applet.', temps=0, btype=1) Frame.bind('<Control-c>', hideApp) Frame.bind('<ButtonRelease-3>', displayFrameMenu) Frame.bind('<Enter>', lambda event: Frame.focus_set()) Frame.columnconfigure(0, weight=1) Frame.columnconfigure(1, weight=2) WIDGETS['frame'] = Frame # - Frame menu - FrameMenu = TK.Menu(Frame, tearoff=0) FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp) FrameMenu.add_command(label='Save', command=saveApp) #FrameMenu.add_command(label='Reset', command=resetApp) CTK.addPinMenu(FrameMenu, 'tkPrefs') WIDGETS['frameMenu'] = FrameMenu # - VARS - # -0- Default mesh display style - V = TK.StringVar(win) V.set('Monocolor wires+solid') VARS.append(V) # -1- Undo V = TK.StringVar(win) V.set('Active') VARS.append(V) # -2- DisplayInfo V = TK.StringVar(win) V.set('Active') VARS.append(V) # -3- bgColor V = TK.StringVar(win) V.set('Black') VARS.append(V) # -4- auto open apps V = TK.StringVar(win) V.set('') VARS.append(V) # -5- Default solid display style - V = TK.StringVar(win) V.set('Monocolor/1-side') VARS.append(V) # -6- Default envmap V = TK.StringVar(win) V.set('windtunnel.png') VARS.append(V) # -7- Selection style V = TK.StringVar(win) V.set('Blue') VARS.append(V) # -8- Export resolution V = TK.StringVar(win) V.set('1120x820') VARS.append(V) # -9- GUI Theme V = TK.StringVar(win) V.set('default') VARS.append(V) # Init VARS par le fichier de preferences CTK.loadPrefFile() for i in CTK.PREFS: k1 = CTK.PREFS[i] if i == 'undo': if k1 == '1': VARS[1].set('Active') elif k1 == '0': VARS[1].set('Inactive') elif i == 'displayInfo': if k1 == '1': VARS[2].set('Active') elif k1 == '0': VARS[2].set('Inactive') elif i == 'bgColor': if k1 == '0': VARS[3].set('Black') elif k1 == '1': VARS[3].set('White') elif k1 == '2': VARS[3].set('Grey') elif k1 == '3': VARS[3].set('Yellow') elif k1 == '4': VARS[3].set('Blue') elif k1 == '5': VARS[3].set('Red') elif k1 == '6': VARS[3].set('Paper1') elif k1 == '7': VARS[3].set('Paper2') elif k1 == '8': VARS[3].set('Arch') elif k1 == '9': VARS[3].set('Jarvis') elif k1 == '10': VARS[3].set('Onera') elif i == 'auto': VARS[4].set(k1) elif i == 'envmap': VARS[6].set(k1) elif i == 'selectionStyle': VARS[7].set(k1) elif i == 'exportResolution': VARS[8].set(k1) elif i == 'guitheme': VARS[9].set(k1) r = 0 # - gui theme - B = TTK.Label(Frame, text="GUI Theme") B.grid(row=r, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Style for GUI (buttons,...).') F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TTK.OptionMenu(F, VARS[9], 'default') B.grid(sticky=TK.EW) F.bind('<Enter>', updateThemeList) F.grid(row=r, column=1, sticky=TK.EW) WIDGETS['guitheme'] = B else: B = ttk.Combobox(F, textvariable=VARS[9], values=[], state='readonly', width=10) B.bind('<<ComboboxSelected>>', setTheme) B.grid(sticky=TK.EW) F.bind('<Enter>', updateThemeList2) F.grid(row=r, column=1, sticky=TK.EW) WIDGETS['guitheme'] = B r += 1 # - Default display info style - B = TTK.Label(Frame, text="Display Info") B.grid(row=r, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Default display info style.') B = TTK.OptionMenu(Frame, VARS[2], 'Active', 'Inactive', command=setDisplayInfo) B.grid(row=r, column=1, sticky=TK.EW) r += 1 # - Default background color - B = TTK.Label(Frame, text="Background") B.grid(row=r, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Default background color or image.') B = TTK.OptionMenu(Frame, VARS[3], 'Black', 'White', 'Grey', 'Yellow', 'Blue', 'Red', 'Paper1', 'Paper2', 'Arch', 'Jarvis', 'Onera', command=setBgColor) B.grid(row=r, column=1, sticky=TK.EW) r += 1 # - Undo - B = TTK.Label(Frame, text="Undo") B.grid(row=r, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Undo is active.') B = TTK.OptionMenu(Frame, VARS[1], 'Active', 'Inactive', command=setUndo) B.grid(row=r, column=1, sticky=TK.EW) r += 1 # - selection style - B = TTK.Label(Frame, text="Selection") B.grid(row=r, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Selection style.') B = TTK.OptionMenu(Frame, VARS[7], 'Blue', 'Alpha', command=setSelectionStyle) B.grid(row=r, column=1, sticky=TK.EW) r += 1 # - Envmap - B = TTK.Label(Frame, text="Envmap") B.grid(row=r, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Environment map (chrome/glass render).') B = TTK.OptionMenu(Frame, VARS[6], 'windtunnel.png', 'sky.png', 'city.png', 'forest.png', 'house.png', command=setEnvmap) B.grid(row=r, column=1, sticky=TK.EW) r += 1 # - export resolution - B = TTK.Label(Frame, text="Export") B.grid(row=r, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Resolution for image export.') B = TTK.Entry(Frame, textvariable=VARS[8], background='White', width=5) B.bind('<Return>', setExportRes) BB = CTK.infoBulle(parent=B, text='Resolution for image export.') B.grid(row=r, column=1, sticky=TK.EW) r += 1 # - Auto open apps - #B = TK.Button(Frame, text='Opened apps', command=getOpenedApps) #BB = CTK.infoBulle(parent=B, text='Keep currently opened apps for next restart.') #B.grid(row=r, column=0, sticky=TK.EW) #B = TK.Button(Frame, text='Classic apps', command=getClassicApps) #BB = CTK.infoBulle(parent=B, text='Keep a classic set of apps for next restart.') #B.grid(row=r, column=1, sticky=TK.EW) #r += 1 #B = TK.Label(Frame, text="Auto open") #B.grid(row=r, column=0, sticky=TK.EW) #BB = CTK.infoBulle(parent=B, text='Open automatically these apps for next restart (tkTree;tkBC;...)') #B = TK.Entry(Frame, textvariable=VARS[4], background='White') #BB = CTK.infoBulle(parent=B, text='Apps opened for next restart (tkTree;tkBC;...)') #B.grid(row=r, column=1, sticky=TK.EW) #r += 1 # - Set prefs - #B = TK.Button(Frame, text="Set prefs", command=setPrefs) #B.grid(row=r, column=0, columnspan=2, sticky=TK.EW) #BB = CTK.infoBulle(parent=B, text='Set prefs in Cassiopee.') #WIDGETS.append(B); r += 1 # - Save prefs - B = TTK.Button(Frame, text="Save prefs", command=savePrefs) B.grid(row=r, column=0, columnspan=2, sticky=TK.EW) B = CTK.infoBulle(parent=B, text='Save pref file (.cassiopee).') r += 1
def createApp(win): ttk = CTK.importTtk() # - Frame - Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE, text='tkInteg', font=CTK.FRAMEFONT, takefocus=1) #BB = CTK.infoBulle(parent=Frame, text='Integrate fields.\nCtrl+c to close applet.', temps=0, btype=1) Frame.bind('<Control-c>', hideApp) Frame.bind('<ButtonRelease-3>', displayFrameMenu) Frame.bind('<Enter>', lambda event: Frame.focus_set()) Frame.columnconfigure(0, weight=1) Frame.columnconfigure(1, weight=1) Frame.columnconfigure(2, weight=1) WIDGETS['frame'] = Frame # - Frame menu - FrameMenu = TK.Menu(Frame, tearoff=0) FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp) CTK.addPinMenu(FrameMenu, 'tkInteg') WIDGETS['frameMenu'] = FrameMenu # - VARS - # -0- Integration type - V = TK.StringVar(win) V.set('INT(v1dS)') VARS.append(V) # -1- Moment center - V = TK.StringVar(win) V.set('0;0;0') VARS.append(V) # -2- Var0 for integration - V = TK.StringVar(win) V.set('CoordinateX') VARS.append(V) # -3- Var1 for integration - V = TK.StringVar(win) V.set('CoordinateY') VARS.append(V) # -4- Var2 for integration - V = TK.StringVar(win) V.set('CoordinateZ') VARS.append(V) # - Menu des integrations - B = TTK.OptionMenu(Frame, VARS[0], \ 'INT(v1dS)', 'INT(v1.ndS)', \ 'INT((v1,v2,v3).ndS)', \ 'INT((v1,v2,v3)^OMdS)', 'INT(v1n^OMdS)') B.grid(row=0, column=0, sticky=TK.EW) # - Centre des moments - B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=5) B.grid(row=0, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Moment center.') # - Bouton compute - B = TTK.Button(Frame, text="Compute", command=compute) B.grid(row=0, column=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Compute integration on contour/surface.') # - Menu des variables - F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[2], '') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList1) F.grid(row=1, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable 1.') WIDGETS['variable1'] = B else: B = ttk.Combobox(F, textvariable=VARS[2], values=[], state='readonly', width=10) B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList1_2) F.grid(row=1, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable 1.') WIDGETS['variable1'] = B F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[3], '') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList2) F.grid(row=1, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable 2.') WIDGETS['variable2'] = B else: B = ttk.Combobox(F, textvariable=VARS[3], values=[], state='readonly', width=10) B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList2_2) F.grid(row=1, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable 2.') WIDGETS['variable2'] = B F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[4], '') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList3) F.grid(row=1, column=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable 3.') WIDGETS['variable3'] = B else: B = ttk.Combobox(F, textvariable=VARS[4], values=[], state='readonly', width=10) B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList3_2) F.grid(row=1, column=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable 3.') WIDGETS['variable3'] = B
def createApp(win): ttk = CTK.importTtk() # - Frame - Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE, text='tkExtractBC', font=CTK.FRAMEFONT, takefocus=1) #BB = CTK.infoBulle(parent=Frame, text='Extract boundary conditions.\nCtrl+c to close applet.', temps=0, btype=1) Frame.bind('<Control-c>', hideApp) Frame.bind('<ButtonRelease-3>', displayFrameMenu) Frame.bind('<Enter>', lambda event : Frame.focus_set()) Frame.columnconfigure(0, weight=2) Frame.columnconfigure(1, weight=2) Frame.columnconfigure(2, weight=0) WIDGETS['frame'] = Frame # - Frame menu - FrameMenu = TK.Menu(Frame, tearoff=0) FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp) FrameMenu.add_command(label='Save', command=saveApp) FrameMenu.add_command(label='Reset', command=resetApp) CTK.addPinMenu(FrameMenu, 'tkExtractBC') WIDGETS['frameMenu'] = FrameMenu # - VARS - # - 0 - Type de BC - V = TK.StringVar(win); V.set('-All BC-'); VARS.append(V) if 'tkExtractBCType' in CTK.PREFS: V.set(CTK.PREFS['tkExtractBCType']) # - 1 - List of zoneBCs to recover V = TK.StringVar(win); V.set(''); VARS.append(V) # - Extract type de BC - B = TTK.Button(Frame, text="Extract", command=extract) B.grid(row=0, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Extract specified BC.\nTree is modified.') F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[0], *(Internal.KNOWNBCS)) B.grid(sticky=TK.EW) F.bind('<Enter>', updateFamilyBCNameList) F.grid(row=0, column=1, columnspan=2, sticky=TK.EW) WIDGETS['BC'] = B else: B = ttk.Combobox(F, textvariable=VARS[0], values=Internal.KNOWNBCS, state='readonly', width=10) B.grid(sticky=TK.EW) F.bind('<Enter>', updateFamilyBCNameList2) F.grid(row=0, column=1, columnspan=2, sticky=TK.EW) WIDGETS['BC'] = B # - Recover BCs - B = TTK.Button(Frame, text="Recover", command=recover) B.grid(row=1, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Recover BCs.\nTree is modified.') B = TTK.Button(Frame, command=setBC2Recover, image=iconics.PHOTO[8], padx=0, pady=0) B.grid(row=1, column=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Set the BC (zones) to recover.') B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=8) B.grid(row=1, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='BCs to recover.')
def createApp(win): ttk = CTK.importTtk() # - Frame - Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE, text='tkPerfo', font=CTK.FRAMEFONT, takefocus=1) #BB = CTK.infoBulle(parent=Frame, text='Improve performance of Cassiopee.\nCtrl+c to close applet.', temps=0, btype=1) Frame.bind('<Control-c>', hideApp) Frame.bind('<ButtonRelease-3>', displayFrameMenu) Frame.bind('<Enter>', lambda event : Frame.focus_set()) Frame.columnconfigure(0, weight=1) Frame.columnconfigure(1, weight=4) Frame.columnconfigure(2, weight=1) WIDGETS['frame'] = Frame # - Frame menu - FrameMenu = TK.Menu(Frame, tearoff=0) FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp) FrameMenu.add_command(label='Save', command=saveApp) FrameMenu.add_command(label='Reset', command=resetApp) CTK.addPinMenu(FrameMenu, 'tkPerfo') WIDGETS['frameMenu'] = FrameMenu # - VARS - # -0- Displayed field - V = TK.StringVar(win); V.set('All fields'); VARS.append(V) # -1- Oneovern - V = TK.StringVar(win); V.set('All points'); VARS.append(V) if 'tkPerfoPoints' in CTK.PREFS: V.set(CTK.PREFS['tkPerfoPoints']) # -2- Threads V = TK.StringVar(win); V.set('1'); VARS.append(V) # - Field transmission - B = TTK.Label(Frame, text="Display") B.grid(row=0, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Describe what part of the tree is displayed.\nCan fasten the display. In memory tree is not modified.') F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[0], 'All fields', 'No field') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList) F.grid(row=0, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Display only certain fields.') WIDGETS['fields'] = B else: B = ttk.Combobox(F, textvariable=VARS[0], values=['All fields', 'No field'], state='readonly', width=10) B.grid(sticky=TK.EW) B.bind('<<ComboboxSelected>>', setViewMode2) F.bind('<Enter>', updateVarNameList2) F.grid(row=0, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Display only certain fields.') WIDGETS['fields'] = B # - Point transmission - B = TTK.OptionMenu(Frame, VARS[1], 'All points', 'One over 2', 'One over 3', 'One over 4', 'Exclusive', command=oneovern) B.grid(row=0, column=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Display less points.') # - OMP threads - B = TTK.Label(Frame, text="Threads") B.grid(row=1, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='The number of CPU cores used by Cassiopee.') F = TTK.Frame(Frame, borderwidth=0) F.grid(row=1, column=1, columnspan=1, sticky=TK.EW) B = TTK.Entry(F, textvariable=VARS[2], background='White', width=3) B.grid(row=0, column=0, columnspan=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Number of threads\n(init value is OMP_NUM_THREADS).') B.bind('<Return>', setThreads) WIDGETS['threads'] = B mxProcs = getMaxProcs() B = TK.Label(F, text='/'+mxProcs) B.grid(row=0, column=1, columnspan=1, sticky=TK.EW) B = TTK.Button(Frame, text="Set", command=setThreads) B.grid(row=1, column=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Set the number of threads.')
def createApp(win): ttk = CTK.importTtk() # - Frame - Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE, text='tkContainers', font=CTK.FRAMEFONT, takefocus=1) #BB = CTK.infoBulle(parent=Frame, text='Manage container names.\nCtrl+c to close applet.', temps=0, btype=1) Frame.bind('<Control-c>', hideApp) Frame.bind('<ButtonRelease-3>', displayFrameMenu) Frame.bind('<Enter>', lambda event : Frame.focus_set()) Frame.columnconfigure(0, weight=1) Frame.columnconfigure(1, weight=4) WIDGETS['frame'] = Frame # - Frame menu - FrameMenu = TK.Menu(Frame, tearoff=0) FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp) FrameMenu.add_command(label='Save', command=saveApp) FrameMenu.add_command(label='Reset', command=resetApp) CTK.addPinMenu(FrameMenu, 'tkContainers') WIDGETS['frameMenu'] = FrameMenu # - VARS - # -0- GridCoordinates container - V = TK.StringVar(win); V.set('GridCoordinates'); VARS.append(V) if 'GridCoordinatesContainer' in CTK.PREFS: V.set(CTK.PREFS['GridCoordinatesContainer']) # -1- FlowSolutionNodes container - V = TK.StringVar(win); V.set('FlowSolution'); VARS.append(V) if 'FlowSolutionNodesContainer' in CTK.PREFS: V.set(CTK.PREFS['FlowSolutionNodesContainer']) # -2- FlowSolutionCenters container - V = TK.StringVar(win); V.set('FlowSolution#Centers'); VARS.append(V) if 'FlowSolutionCentersContainer' in CTK.PREFS: V.set(CTK.PREFS['FlowSolutionCentersContainer']) # - GridCoordinates - B = TTK.Label(Frame, text="GridCoordinates") B.grid(row=0, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='This name will be used to find coordinates node in zones.') F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.Entry(F, textvariable=VARS[0], background='White') B.grid(sticky=TK.EW) F.bind('<Return>', setNames) F.grid(row=0, column=1, sticky=TK.EW) WIDGETS['GridCoordinates'] = B else: B = ttk.Combobox(F, textvariable=VARS[0], values=[], state='normal') B.grid(sticky=TK.EW) F.bind('<Enter>', updateGridCoordinates) B.bind('<Return>', setNames) F.grid(row=0, column=1, sticky=TK.EW) WIDGETS['GridCoordinates'] = B # - FlowSolutionNodes - B = TTK.Label(Frame, text="FlowSolutionNodes") B.grid(row=1, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='This name will be used to find solution node in zones.') F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.Entry(F, textvariable=VARS[1], background='White') B.grid(sticky=TK.EW) F.bind('<Return>', setNames) F.grid(row=1, column=1, sticky=TK.EW) WIDGETS['FlowSolution'] = B else: B = ttk.Combobox(F, textvariable=VARS[1], values=[], state='normal') B.grid(sticky=TK.EW) F.bind('<Enter>', updateFlowSolution) B.bind('<Return>', setNames) F.grid(row=1, column=1, sticky=TK.EW) WIDGETS['FlowSolution'] = B # - FlowSolutionCenters - B = TTK.Label(Frame, text="FlowSolutionCenters") B.grid(row=2, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='This name will be used to find centers solution node in zones.') F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.Entry(F, textvariable=VARS[2], background='White') B.grid(sticky=TK.EW) F.bind('<Return>', setNames) F.grid(row=2, column=1, sticky=TK.EW) WIDGETS['FlowSolutionCenters'] = B else: B = ttk.Combobox(F, textvariable=VARS[2], values=[], state='normal') B.grid(sticky=TK.EW) F.bind('<Enter>', updateFlowSolutionCenters) B.bind('<Return>', setNames) F.grid(row=2, column=1, sticky=TK.EW) WIDGETS['FlowSolutionCenters'] = B # - set - B = TTK.Button(Frame, text="Set", command=setNames) BB = CTK.infoBulle(parent=B, text='Change the container names used by Cassiopee functions.') B.grid(row=3, column=0, columnspan=2, sticky=TK.EW)
def createApp(win): ttk = CTK.importTtk() # - Frame - Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE, text='tkIsoLine', font=CTK.FRAMEFONT, takefocus=1) #BB = CTK.infoBulle(parent=Frame, text='Compute isolines.\nCtrl+c to close applet.', temps=0, btype=1) Frame.bind('<Control-c>', hideApp) Frame.bind('<ButtonRelease-3>', displayFrameMenu) Frame.bind('<Enter>', lambda event: Frame.focus_set()) Frame.columnconfigure(0, weight=1) Frame.columnconfigure(1, weight=1) Frame.columnconfigure(2, weight=1) WIDGETS['frame'] = Frame # - Frame menu - FrameMenu = TK.Menu(Frame, tearoff=0) FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp) FrameMenu.add_command(label='Save', command=saveApp) FrameMenu.add_command(label='Reset', command=resetApp) CTK.addPinMenu(FrameMenu, 'tkIsoLine') WIDGETS['frameMenu'] = FrameMenu # - VARS - # -0- Field name - V = TK.StringVar(win) V.set('CoordinateX') VARS.append(V) # -1- nlevels - V = TK.StringVar(win) V.set('25') VARS.append(V) if 'tkIsoLineLevels' in CTK.PREFS: V.set(CTK.PREFS['tkIsoLineLevels']) # -2- value - V = TK.StringVar(win) V.set('1.') VARS.append(V) if 'tkIsoLineValue' in CTK.PREFS: V.set(CTK.PREFS['tkIsoLineValue']) # -3- min iso V = TK.StringVar(win) V.set('MIN') VARS.append(V) if 'tkIsoLineMin' in CTK.PREFS: V.set(CTK.PREFS['tkIsoLineMin']) # -4- max iso V = TK.StringVar(win) V.set('MAX') VARS.append(V) V = TK.StringVar(win) V.set('MIN') VARS.append(V) if 'tkIsoLineMax' in CTK.PREFS: V.set(CTK.PREFS['tkIsoLineMax']) # - field name - B = TTK.Label(Frame, text="Field:") B.grid(row=0, column=0, sticky=TK.EW) F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[0], '') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList) F.grid(row=0, column=1, columnspan=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Extracted field.') WIDGETS['field'] = B else: B = ttk.Combobox(F, textvariable=VARS[0], values=[], state='readonly') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList2) F.grid(row=0, column=1, columnspan=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Extracted field.') WIDGETS['field'] = B if CTK.t != []: vars = C.getVarNames(CTK.t) if (len(vars) > 0): if (len(vars[0]) > 0): VARS[0].set(vars[0][0]) # - nlevels - #B = TK.Label(Frame, text="Nlevels:") #B.grid(row=1, column=0, sticky=TK.EW) B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=7) BB = CTK.infoBulle(parent=B, text='Number of levels.') B.grid(row=1, column=0, sticky=TK.EW) B = TTK.Entry(Frame, textvariable=VARS[3], background='White', width=7) BB = CTK.infoBulle(parent=B, text='Min value.') B.grid(row=1, column=1, sticky=TK.EW) B = TTK.Entry(Frame, textvariable=VARS[4], background='White', width=7) BB = CTK.infoBulle(parent=B, text='Max value.') B.grid(row=1, column=2, sticky=TK.EW) # - Draw all isolines - B = TTK.Button(Frame, text="Extract isolines", command=drawIsoLines) BB = CTK.infoBulle(parent=B, text='Extract isolines.') B.grid(row=2, column=0, columnspan=3, sticky=TK.EW) # - Value - B = TTK.Label(Frame, text="Value:") B.grid(row=3, column=0, sticky=TK.EW) B = TTK.Entry(Frame, textvariable=VARS[2], background='White') B.grid(row=3, column=1, columnspan=2, sticky=TK.EW) # - Extract one isoline - B = TTK.Button(Frame, text="Extract isoline", command=extractIsoLine) B.grid(row=4, column=0, columnspan=3, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Extract one isoline to CONTOURS.')
def createApp(win): ttk = CTK.importTtk() # - Frame - Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE, text='tkTreeOps', font=CTK.FRAMEFONT, takefocus=1) #BB = CTK.infoBulle(parent=Frame, text='Operations on pyTree.\nCtrl+c to close applet.', temps=0, btype=1) Frame.bind('<Control-c>', hideApp) Frame.bind('<ButtonRelease-3>', displayFrameMenu) Frame.bind('<Enter>', lambda event: Frame.focus_set()) Frame.columnconfigure(0, weight=1) Frame.columnconfigure(1, weight=1) Frame.columnconfigure(2, weight=1) WIDGETS['frame'] = Frame # - Frame menu - FrameMenu = TK.Menu(Frame, tearoff=0) FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp) CTK.addPinMenu(FrameMenu, 'tkTreeOps') WIDGETS['frameMenu'] = FrameMenu # - VARS - # -0- Base to move to - V = TK.StringVar(win) V.set('New Base') VARS.append(V) # -1- Displayed index V = TK.StringVar(win) V.set('0') VARS.append(V) # -2- Displayed node value V = TK.StringVar(win) V.set('') VARS.append(V) # -3- Displayed node type V = TK.StringVar(win) V.set('') VARS.append(V) # -4- Displayed node name V = TK.StringVar(win) V.set('') VARS.append(V) # -5- Name/Type to be deleted V = TK.StringVar(win) V.set('') VARS.append(V) # -6- Type of deletion V = TK.StringVar(win) V.set('Name') VARS.append(V) # - Move selection to base - B = TTK.Button(Frame, text="Move sel. to", command=moveSelection) BB = CTK.infoBulle(parent=B, text='Move selected zones to another base.') B.grid(row=0, column=0, sticky=TK.EW) F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[0], '') B.grid(sticky=TK.EW) F.bind('<Enter>', updateBaseNameList) else: VARS[0].set('newBase') B = ttk.Combobox(F, textvariable=VARS[0], values=[], state='normal') B.grid(sticky=TK.EW) F.bind('<Enter>', updateBaseNameList2) F.grid(row=0, column=1, columnspan=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Destination Base name.') WIDGETS['base'] = B # - Move nodes up/down/import selection in tkTree B = TTK.Button(Frame, text="Node Up", command=moveNodeUp) BB = CTK.infoBulle(parent=B, text='Move selected node in tkTree up.') B.grid(row=1, column=0, sticky=TK.EW) B = TTK.Button(Frame, text="Node Down", command=moveNodeDown) BB = CTK.infoBulle(parent=B, text='Move selected node in tkTree down.') B.grid(row=1, column=1, columnspan=2, sticky=TK.EW) # - Rm Nodes - #B = TK.Button(Frame, text="Rm node(s)", command=rmNodes) #BB = CTK.infoBulle(parent=B, text='Remove nodes from tree.\nYou can also use the Suppr key.') #B.grid(row=2, column=0, sticky=TK.EW) #B = TK.OptionMenu(Frame, VARS[6], 'Name', 'Type', 'Value') #B.grid(row=2, column=1, sticky=TK.EW) #B = TK.Entry(Frame, textvariable=VARS[5], background='White', width=5) #BB = CTK.infoBulle(parent=B, text='Enter node name or types. Wildcards are accepted.') #B.grid(row=2, column=2, sticky=TK.EW) # - Small node editor - F = TTK.LabelFrame(Frame, borderwidth=2, relief=CTK.FRAMESTYLE, text='Edit node', takefocus=1) F.columnconfigure(0, weight=1) F.columnconfigure(1, weight=4) F.grid(row=3, column=0, columnspan=3, sticky=TK.EW) B = TTK.Entry(F, textvariable=VARS[4], background='White', width=5) B.grid(row=0, column=0, columnspan=1, sticky=TK.EW) BB = CTK.infoBulle( parent=B, text='Selected node name.\nYou can change this by pressing <Enter>.') B.bind('<Return>', setNodeName) B = TTK.Entry(F, textvariable=VARS[3], background='White', width=5) B.grid(row=0, column=1, columnspan=1, sticky=TK.EW) BB = CTK.infoBulle( parent=B, text='Selected node type.\nYou can change this by pressing <Enter>.') B.bind('<Return>', setNodeType) FrameA = TK.Frame(F) FrameA.columnconfigure(0, weight=0) FrameA.columnconfigure(1, weight=1) FrameA.columnconfigure(2, weight=0) FrameA.grid(row=1, column=0, sticky=TK.EW) B = TTK.Entry(FrameA, textvariable=VARS[1], background='White', width=5) B.grid(row=0, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Displayed index (start: 0).') B.bind('<Return>', showNodeValue) B = TTK.Button(FrameA, text="<", command=decreaseIndex, width=2) B.grid(row=0, column=0, sticky=TK.EW) B = TTK.Button(FrameA, text=">", command=increaseIndex, width=2) B.grid(row=0, column=2, sticky=TK.EW) B = TTK.Entry(F, textvariable=VARS[2], background='White', width=5) B.grid(row=1, column=1, columnspan=1, sticky=TK.EW) BB = CTK.infoBulle( parent=B, text= 'Selected node value at given index.\nYou can change this by pressing <Enter>.' ) B.bind('<Return>', setNodeValue)
def createApp(win): ttk = CTK.importTtk() # - Frame - Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE, text='tkPlot', font=CTK.FRAMEFONT, takefocus=1) #BB = CTK.infoBulle(parent=Frame, text='My personal applet.\nCtrl+c to close applet.', temps=0, btype=1) Frame.bind('<Control-c>', hideApp) Frame.bind('<ButtonRelease-3>', displayFrameMenu) Frame.bind('<Enter>', lambda event: Frame.focus_set()) Frame.columnconfigure(0, weight=1) Frame.columnconfigure(1, weight=1) Frame.columnconfigure(2, weight=1) WIDGETS['frame'] = Frame # - Frame menu - FrameMenu = TK.Menu(Frame, tearoff=0) FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp) FrameMenu.add_command(label='Save', command=saveApp) FrameMenu.add_command(label='Reset', command=resetApp) CTK.addPinMenu(FrameMenu, 'tkPlot') WIDGETS['frameMenu'] = FrameMenu # - VARS - # -0- Direction - V = TK.StringVar(win) V.set('None') VARS.append(V) if 'tkPlotDirection' in CTK.PREFS: V.set(CTK.PREFS['tkPlotDirection']) # -1- grid size - V = TK.StringVar(win) V.set('3;3') VARS.append(V) if 'tkPlotGridSize' in CTK.PREFS: V.set(CTK.PREFS['tkPlotGridSize']) # -2- grid pos - V = TK.StringVar(win) V.set('0;0') VARS.append(V) if 'tkPlotGridPos' in CTK.PREFS: V.set(CTK.PREFS['tkPlotGridPos']) # -3- Var1 V = TK.StringVar(win) V.set('CoordinateX') VARS.append(V) # -4- Var2 V = TK.StringVar(win) V.set('CoordinateX') VARS.append(V) # -5- Slot V = TK.StringVar(win) V.set('0') VARS.append(V) # - Slot - B = TTK.Entry(Frame, textvariable=VARS[5], width=2) BB = CTK.infoBulle(parent=B, text='Slot.') B.grid(row=0, column=0, columnspan=1, sticky=TK.EW) # - grid size - B = TTK.Entry(Frame, textvariable=VARS[1], width=2) BB = CTK.infoBulle(parent=B, text='Grid size (1;1).') B.grid(row=0, column=1, columnspan=1, sticky=TK.EW) # - grid pos - B = TTK.Entry(Frame, textvariable=VARS[2], width=2) BB = CTK.infoBulle(parent=B, text='Position of slot in grid (0;0).') B.grid(row=0, column=2, columnspan=1, sticky=TK.EW) # - Element 1D - B = TTK.OptionMenu(Frame, VARS[0], 'None', 'X (Y)', 'Y (X)', 'Z (X)', 'X (Z)', 'Y (Z)', 'Z (Y)', 'I', 'J', 'K', 'Elements') B.grid(row=1, column=0, columnspan=3, sticky=TK.EW) # Var1 F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[3], '') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVar1NameList) F.grid(row=2, column=1, columnspan=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable 1 (abcsiss).') WIDGETS['var1'] = B else: B = ttk.Combobox(F, textvariable=VARS[3], values=[], state='readonly', width=10) B.grid(sticky=TK.EW) F.bind('<Enter>', updateVar1NameList2) F.grid(row=2, column=1, columnspan=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable 1 (absciss).') WIDGETS['var1'] = B # Var2 F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[4], '') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVar2NameList) F.grid(row=2, column=0, columnspan=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable 2 (ordinates).') WIDGETS['var2'] = B else: B = ttk.Combobox(F, textvariable=VARS[4], values=[], state='readonly', width=10) B.grid(sticky=TK.EW) F.bind('<Enter>', updateVar2NameList2) F.grid(row=2, column=0, columnspan=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable 2 (ordinates).') WIDGETS['var2'] = B # - Ranges - B = TTK.Scale(Frame, from_=0, to=100, orient=TK.HORIZONTAL, showvalue=0, borderwidth=1, command=display1D, value=50) WIDGETS['rangePos'] = B B.grid(row=3, column=0, columnspan=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Move range.') B = TTK.Scale(Frame, from_=0, to=100, orient=TK.HORIZONTAL, showvalue=0, borderwidth=1, command=display1D, value=0) WIDGETS['rangeZoom'] = B B.grid(row=3, column=1, columnspan=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Zoom range.') # - Set in slot - B = TTK.Button(Frame, text="Set", command=display1D) B.grid(row=4, column=0, columnspan=3, sticky=TK.EW)
def createApp(win): ttk = CTK.importTtk() # - Frame - Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE, text='tkVariable', font=CTK.FRAMEFONT, takefocus=1) #BB = CTK.infoBulle(parent=Frame, text='Manage field variables.\nCtrl+c to close applet.', temps=0, btype=1) Frame.bind('<Control-c>', hideApp) Frame.bind('<ButtonRelease-3>', displayFrameMenu) Frame.bind('<Enter>', lambda event: Frame.focus_set()) Frame.columnconfigure(0, weight=1) Frame.columnconfigure(1, weight=4) WIDGETS['frame'] = Frame # - Frame menu - FrameMenu = TK.Menu(Frame, tearoff=0) FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp) FrameMenu.add_command(label='Save', command=saveApp) FrameMenu.add_command(label='Reset', command=resetApp) CTK.addPinMenu(FrameMenu, 'tkVariables') WIDGETS['frameMenu'] = FrameMenu # - VARS - # -0- computeVariable name V = TK.StringVar(win) V.set('Pressure') VARS.append(V) if 'tkVariablesName' in CTK.PREFS: V.set(CTK.PREFS['tkVariablesName']) # -1- addVar V = TK.StringVar(win) V.set('Density') VARS.append(V) if 'tkVariablesAddVar' in CTK.PREFS: V.set(CTK.PREFS['tkVariablesAddVar']) # -2- computeGrad - V = TK.StringVar(win) V.set('CoordinateX') VARS.append(V) # -3- computeCurl - V = TK.StringVar(win) V.set('MomentumX;MomentumY;MomentumZ') VARS.append(V) # -4- importFile - V = TK.StringVar(win) V.set('output.plt') VARS.append(V) if 'tkVariablesImportFile' in CTK.PREFS: V.set(CTK.PREFS['tkVariablesImportFile']) # -5- Rm variable V = TK.StringVar(win) V.set('All') VARS.append(V) # -6- Var location V = TK.StringVar(win) V.set('nodes') VARS.append(V) if 'tkVariablesLoc' in CTK.PREFS: V.set(CTK.PREFS['tkVariablesLoc']) # -7- adim type V = TK.StringVar(win) V.set('Adim1 (ro,a,T)') VARS.append(V) if 'tkVariablesAdim' in CTK.PREFS: V.set(CTK.PREFS['tkVariablesAdim']) # -8- center2Node variable V = TK.StringVar(win) V.set('FlowSolutionCenters') VARS.append(V) # -9- node2Center variable V = TK.StringVar(win) V.set('FlowSolutionNodes') VARS.append(V) # -10- renameVar variable - new V = TK.StringVar(win) V.set('CoordinateX') VARS.append(V) # -11- renameVar variable - prev V = TK.StringVar(win) V.set('x') VARS.append(V) # - importFile - norow = 0 B = TTK.Button(Frame, text="Import file", command=importFile) B.grid(row=norow, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Import solution file into existing pyTree.') F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) F.columnconfigure(1, weight=0) B = TTK.Entry(F, textvariable=VARS[4], background='White') B.bind('<Return>', importFile) B.grid(row=norow, column=0, sticky=TK.EW) B = TTK.Button(F, text="...", padx=0, command=chooseImportFile) BB = CTK.infoBulle(parent=B, text='Select solution file.') B.grid(row=norow, column=1, sticky=TK.EW) F.grid(row=norow, column=1, sticky=TK.EW) # - addVar - norow += 1 B = TTK.Button(Frame, text="Add/modify variable", command=addVar) B.grid(row=norow, column=0, sticky=TK.EW) BB = CTK.infoBulle( parent=B, text= 'Add a new variable into pyTree. A formula of type: Density=3*{CoordinateX} can be specified.' ) B = TTK.Entry(Frame, textvariable=VARS[1], background='White') B.bind('<Return>', addVar) B.grid(row=norow, column=1, sticky=TK.EW) # - rmVar - norow += 1 B = TTK.Button(Frame, text="Rm variable", command=rmVar) B.grid(row=norow, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Rm variable from pyTree.') F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[5], '') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList1) F.grid(row=norow, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Removed variable.') WIDGETS['var1'] = B else: B = ttk.Combobox(F, textvariable=VARS[5], values=[], state='readonly') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList1_2) F.grid(row=norow, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Removed variable.') WIDGETS['var1'] = B # - renameVar - #norow+= 1 #F = TTK.Frame(Frame, borderwidth=0) #F.columnconfigure(0, weight=1) #if ttk is None: # B = TK.OptionMenu(F, VARS[11], '') # B.grid(sticky=TK.EW) # F.bind('<Enter>', updateVarNameList5) # F.grid(row=norow, column=0, sticky=TK.EW) # BB = CTK.infoBulle(parent=B, text='Renamed variable.') # WIDGETS['var5'] = B #else: # B = ttk.Combobox(F, textvariable=VARS[11], # values=[], state='readonly') # B.grid(sticky=TK.EW) # F.bind('<Enter>', updateVarNameList5_2) # F.grid(row=norow, column=0, sticky=TK.EW) # BB = CTK.infoBulle(parent=B, text='Renamed variable.') # WIDGETS['var5'] = B #B = TK.Entry(Frame, textvariable=VARS[10], background='White') #B.bind('<Return>', renameVar) #B.grid(row=norow, column=1, sticky=TK.EW) #norow+=1 #B = TK.Button(Frame, text="Rename variable", command=renameVar) #B.grid(row=norow, column=0, columnspan=2, sticky=TK.EW) #BB = CTK.infoBulle(parent=B, text='Rename variable from pyTree.') # - center2Node var - norow += 1 B = TTK.Button(Frame, text="Center2Node", command=center2NodeVar) B.grid(row=norow, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Put a center variable to nodes in pyTree.') F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[8], '') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList3) F.grid(row=norow, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Center variable to be set in nodes.') WIDGETS['var3'] = B else: B = ttk.Combobox(F, textvariable=VARS[8], values=[], state='readonly') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList3_2) F.grid(row=norow, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Center variable to be set in nodes.') WIDGETS['var3'] = B # - node2Center var - norow += 1 B = TTK.Button(Frame, text="Node2Center", command=node2CenterVar) B.grid(row=norow, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Put a node variable to centers in pyTree.') F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[9], '') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList4) F.grid(row=norow, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Node variable to be set in centers.') WIDGETS['var4'] = B else: B = ttk.Combobox(F, textvariable=VARS[9], values=[], state='readonly') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList4_2) F.grid(row=norow, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Node variable to be set in centers.') WIDGETS['var4'] = B # - computeGrad - norow += 1 F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) F.columnconfigure(1, weight=1) B = TTK.Button(F, text="Grad", command=computeGrad) BB = CTK.infoBulle(parent=B, text='Compute gradient of variables.') B.grid(row=0, column=0, sticky=TK.EW) B = TTK.Button(F, text="Norm", command=computeNormGrad) BB = CTK.infoBulle(parent=B, text='Compute gradient\' norm of variables.') B.grid(row=0, column=1, sticky=TK.EW) F.grid(row=norow, column=0, sticky=TK.EW) F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[2], '') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList2) F.grid(row=norow, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable for gradient.') WIDGETS['var2'] = B else: B = ttk.Combobox(F, textvariable=VARS[2], values=[], state='readonly') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList2_2) F.grid(row=norow, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable for gradient.') WIDGETS['var2'] = B # - computeCurl - norow += 1 F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) F.columnconfigure(1, weight=1) B = TTK.Button(F, text="Curl ", command=computeCurl) BB = CTK.infoBulle(parent=B, text='Compute curl of variables.') B.grid(row=0, column=0, sticky=TK.EW) B = TTK.Button(F, text="Norm", command=computeNormCurl) BB = CTK.infoBulle(parent=B, text='Compute gradient\' norm of variables.') B.grid(row=0, column=1, sticky=TK.EW) F.grid(row=norow, column=0, sticky=TK.EW) B = TTK.Entry(Frame, textvariable=VARS[3], background='White') BB = CTK.infoBulle(parent=B, text='Variables for curl.') B.grid(row=norow, column=1, sticky=TK.EW) # - computeVariables - norow += 1 B = TTK.OptionMenu(Frame, VARS[7], 'Adim1 (ro,a,T)', 'Adim2 (ro,u,T)') B.grid(row=norow, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Use this adimensioning for variable computation.') B = TTK.OptionMenu(Frame, VARS[6], 'nodes', 'centers') B.grid(row=norow, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Computed variable will be localized here.') norow += 1 B = TTK.Button(Frame, text="Compute variable", command=computeVariables) B.grid(row=norow, column=0, sticky=TK.EW) B = TTK.OptionMenu(Frame, VARS[0],'Pressure','Temperature', 'VelocityMagnitude','VelocityX',\ 'VelocityY','VelocityZ','Enthalpy','Entropy','Mach',\ 'ViscosityMolecular','PressureStagnation',\ 'TemperatureStagnation', 'PressureDynamic', 'Vorticity', 'VorticityMagnitude', 'QCriterion', 'ShearStress', 'SkinFriction', 'SkinFrictionTangential') B.grid(row=norow, column=1, sticky=TK.EW) # fill missing variables norow += 1 B = TTK.Button(Frame, text="Fill missing variables", command=fillMissingVariables) B.grid(row=norow, column=0, columnspan=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='All zones will have the same variables.')
def createApp(win): ttk = CTK.importTtk() # - Frame - Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE, text='tkRenderSet', font=CTK.FRAMEFONT, takefocus=1) #BB = CTK.infoBulle(parent=Frame, text='Customize block rendering\n(render mode).\nCtrl+c to close applet.', temps=0, btype=1) Frame.bind('<Control-c>', hideApp) Frame.bind('<ButtonRelease-3>', displayFrameMenu) Frame.bind('<Enter>', lambda event: Frame.focus_set()) Frame.columnconfigure(0, weight=1) Frame.columnconfigure(1, weight=1) WIDGETS['frame'] = Frame # - Frame menu - FrameMenu = TK.Menu(Frame, tearoff=0) FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp) CTK.addPinMenu(FrameMenu, 'tkRenderSet') WIDGETS['frameMenu'] = FrameMenu # - VARS - # -0- Material - V = TK.StringVar(win) V.set('Solid') VARS.append(V) # -1- Color - V = TK.StringVar(win) V.set('White') VARS.append(V) # -2- Blending V = TK.StringVar(win) V.set('1.') VARS.append(V) # -3- Mesh overlay V = TK.StringVar(win) V.set('0') VARS.append(V) # -4- Shader parameter1 info bulle V = TK.StringVar(win) V.set('Shader parameter 1.') VARS.append(V) # -5- Shader parameter2 info bulle V = TK.StringVar(win) V.set('Shader parameter 2.') VARS.append(V) # -6- Blending info bulle V = TK.StringVar(win) V.set('Blending.') VARS.append(V) # - set Blending - B = TTK.Scale(Frame, from_=0, to=100, orient=TK.HORIZONTAL, command=setBlending, showvalue=0, borderwidth=1, value=100) WIDGETS['blending'] = B B.grid(row=0, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, textVariable=VARS[6]) # - set mesh overlay - B = TTK.Checkbutton(Frame, text='Mesh', variable=VARS[3], command=setMeshOverlay) BB = CTK.infoBulle(parent=B, text='Add underlaying mesh.') B.grid(row=0, column=1, sticky=TK.EW) # - set shader parameter 1 & 2- B = TTK.Scale(Frame, from_=0, to=100, orient=TK.HORIZONTAL, command=setShaderParameter, showvalue=0, borderwidth=1, value=50) WIDGETS['param1'] = B B.grid(row=1, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, textVariable=VARS[4]) # - set shader parameter 2 - B = TTK.Scale(Frame, from_=0, to=100, orient=TK.HORIZONTAL, command=setShaderParameter, showvalue=0, borderwidth=1, value=50) WIDGETS['param2'] = B B.grid(row=1, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, textVariable=VARS[5]) # - set Material - B = TTK.Button(Frame, text="Set Material", command=setMaterial) B.grid(row=2, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Set the material render property.') B = TTK.OptionMenu(Frame, VARS[0], *MATERIALS) B.grid(row=2, column=1, sticky=TK.EW) # - set Color - B = TTK.Button(Frame, text="Set Color", command=setColor) B.grid(row=3, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Set the color render property.') F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[1], '') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList) F.grid(row=3, column=1, sticky=TK.EW) WIDGETS['colors'] = B else: B = ttk.Combobox(F, textvariable=VARS[1], values=[], state='readonly', height=11) B.bind('<<ComboboxSelected>>', setColorVar2) B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList2) F.grid(row=3, column=1, sticky=TK.EW) WIDGETS['colors'] = B # - set all properties - F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) F.columnconfigure(1, weight=0) B = TTK.Button(F, text="Set all properties", command=setAll) B.grid(row=0, column=0, columnspan=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Set all render properties.') B = TTK.Button(F, command=getData, image=iconics.PHOTO[8], padx=0, pady=0) BB = CTK.infoBulle(parent=B, text='Get data from selected zone.') B.grid(row=0, column=1, sticky=TK.EW) F.grid(row=4, column=0, columnspan=2, sticky=TK.EW)
def createApp(win): # - Frame - Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE, text='tkState', font=CTK.FRAMEFONT, takefocus=1) #BB = CTK.infoBulle(parent=Frame, text='Set information on case.\nCtrl+c to close applet.', temps=0, btype=1) Frame.bind('<Control-c>', hideApp) Frame.bind('<ButtonRelease-3>', displayFrameMenu) Frame.bind('<Enter>', lambda event: Frame.focus_set()) Frame.columnconfigure(0, weight=1) WIDGETS['frame'] = Frame # - Frame menu - FrameMenu = TK.Menu(Frame, tearoff=0) FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp) CTK.addPinMenu(FrameMenu, 'tkState') WIDGETS['frameMenu'] = FrameMenu # - VARS - # -0- Pb dim - V = TK.StringVar(win) V.set('3D') VARS.append(V) # -1- Model - V = TK.StringVar(win) V.set('Euler') VARS.append(V) # -2- Mach - V = TK.StringVar(win) V.set('0.5') VARS.append(V) # -3- Reinf - V = TK.StringVar(win) V.set('1.e8') VARS.append(V) # -4- Incidence/Z - V = TK.StringVar(win) V.set('0.') VARS.append(V) # -5- Incidence/Y - V = TK.StringVar(win) V.set('0.') VARS.append(V) # -6- Type de modele de turbulence V = TK.StringVar(win) V.set('SpalartAllmaras') VARS.append(V) # -7- Valeurs pour les grandeurs turbulentes V = TK.StringVar(win) V.set('1.e-6') VARS.append(V) # -8- Jeux de variables definissant l'etat de reference V = TK.StringVar(win) V.set('[adim1] ro,T,a') VARS.append(V) # -9- MutSMuInf V = TK.StringVar(win) V.set('0.2') VARS.append(V) # -10- TurbLevelInf V = TK.StringVar(win) V.set('1.e-4') VARS.append(V) # -11- Adim V = TK.StringVar(win) V.set('adim1(Ro,A,T)') VARS.append(V) # - Pb dim - F = TTK.Frame(Frame, borderwidth=2, relief=CTK.FRAMESTYLE) F.columnconfigure(0, weight=1) F.columnconfigure(1, weight=2) F.columnconfigure(1, weight=2) B = TTK.Label(F, text="Pb dim") B.grid(row=0, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Dimension of the problem.') B = TTK.OptionMenu(F, VARS[0], '3D', '2D', command=setDim) B.grid(row=0, column=1, sticky=TK.EW) B = TTK.Button(F, text="Set dim", command=setDim) BB = CTK.infoBulle(parent=B, text='Set dim in all bases.') B.grid(row=0, column=2, sticky=TK.EW) F.grid(row=0, column=0, sticky=TK.EW) F = TTK.Frame(Frame, borderwidth=2, relief=CTK.FRAMESTYLE) F.columnconfigure(0, weight=1) F.columnconfigure(1, weight=4) # - Modele de fluide - B = TTK.Label(F, text="GovEquations") B.grid(row=1, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Governing equations to solve.') B = TTK.OptionMenu(F, VARS[1], 'Euler', 'NSLaminar', 'NSTurbulent') B.grid(row=1, column=1, sticky=TK.EW) # - Jeu de grandeurs definissant l'etat de reference - #B = TK.Label(F, text="Variables") #B.grid(row=2, column=0, sticky=TK.EW) #BB = CTK.infoBulle(parent=B, text='Change the set of variables defining the reference state.') #B = TK.OptionMenu(F, VARS[8], '[adim1] ro,a,T', '[adim2] ro,u,T', '[dim1] U,T,P,L', '[dim2] ro,u,T,L', '[dim3] ro,u,P,L') #B.grid(row=2, column=1, sticky=TK.EW) # - Mach - B = TTK.Label(F, text="Mach") B.grid(row=2, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Reference (infinite) mach number.') B = TTK.Entry(F, textvariable=VARS[2], background='White') B.grid(row=2, column=1, sticky=TK.EW) # - Reynolds - B = TTK.Label(F, text="Reynolds") B.grid(row=3, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Reference (infinite) Reynolds number.') B = TTK.Entry(F, textvariable=VARS[3], background='White') B.grid(row=3, column=1, sticky=TK.EW) # - Incidence/Z - B = TTK.Label(F, text="Incidence/Z (deg)") BB = CTK.infoBulle(parent=B, text='Angle of incident flow around z axis.') B.grid(row=4, column=0, sticky=TK.EW) B = TTK.Entry(F, textvariable=VARS[4], background='White') B.grid(row=4, column=1, sticky=TK.EW) # - Incidence/Y - B = TTK.Label(F, text="Incidence/Y (deg)") B.grid(row=5, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Angle of incident flow around y axis.') B = TTK.Entry(F, textvariable=VARS[5], background='White') B.grid(row=5, column=1, sticky=TK.EW) # - Modele de turbulence - B = TTK.Label(F, text="TubulenceModel") B.grid(row=6, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Type of turbulence model.') B = TTK.OptionMenu(F, VARS[6], 'SpalartAllmaras', 'JonesLaunder(k-eps)', 'Wilcox(k-w)', 'MenterSST(k-w)') B.grid(row=6, column=1, sticky=TK.EW) # - Valeurs des grandeurs turbulentes - B = TTK.Label(F, text="MutSMu") B.grid(row=7, column=0, sticky=TK.EW) BB = CTK.infoBulle( parent=B, text='Ratio between turbulent viscosity and molecular viscosity.') B = TTK.Entry(F, textvariable=VARS[9], background='White') B.grid(row=7, column=1, sticky=TK.EW) B = TTK.Label(F, text="TurbLevel") B.grid(row=8, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Level of turbulence.') B = TTK.Entry(F, textvariable=VARS[10], background='White') B.grid(row=8, column=1, sticky=TK.EW) # - Adim - B = TTK.Label(F, text="Adim") B.grid(row=9, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Type of adimensionalization.') B = TTK.OptionMenu( F, VARS[11], 'adim1(Ro,A,T)', 'adim2(Ro,U,T)' ) #,'dim1(real UInf,TInf,PInf,Rgp=287.053)', 'dim2(real UInf,TInf,RoInf,Rgp=287.053)','dim3(real UInf,PInf,RoInf,Rgp=287.053)') B.grid(row=9, column=1, sticky=TK.EW) # - get state, inutile a mon avis - B = TTK.Button(F, text="Get state", command=getState) B.grid(row=10, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Read state from pyTree.') # - set state - B = TTK.Button(F, text="Set state", command=setState) B.grid(row=10, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Write state to pyTree.') F.grid(row=1, column=0, sticky=TK.EW)
def createApp(win): ttk = CTK.importTtk() # - Frame - Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE, text='tkIsoSurf', font=CTK.FRAMEFONT, takefocus=1) #BB = CTK.infoBulle(parent=Frame, text='Compute iso-surfaces.\nCtrl+c to close applet.', temps=0, btype=1) Frame.bind('<Control-c>', hideApp) Frame.bind('<ButtonRelease-3>', displayFrameMenu) Frame.bind('<Enter>', lambda event : Frame.focus_set()) Frame.columnconfigure(0, weight=1) Frame.columnconfigure(1, weight=1) Frame.columnconfigure(2, weight=0) WIDGETS['frame'] = Frame # - Frame menu - FrameMenu = TK.Menu(Frame, tearoff=0) FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp) FrameMenu.add_command(label='Save', command=saveApp) FrameMenu.add_command(label='Reset', command=resetApp) CTK.addPinMenu(FrameMenu, 'tkIsoSurf') WIDGETS['frameMenu'] = FrameMenu # - VARS - # -0- Field name - V = TK.StringVar(win); V.set('CoordinateX'); VARS.append(V) # -1- value - V = TK.StringVar(win); V.set('1.'); VARS.append(V) if 'tkIsoSurfValue' in CTK.PREFS: V.set(CTK.PREFS['tkIsoSurfValue']) # - field name - F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[0], '') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList) F.grid(row=0, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Extracted field.') WIDGETS['field'] = B else: B = ttk.Combobox(F, textvariable=VARS[0], values=[], state='readonly', width=10) B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList2) F.grid(row=0, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Extracted field.') WIDGETS['field'] = B # - Value - B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=7) BB = CTK.infoBulle(parent=B, text='Extracted field value.') B.bind('<Return>', extractIsoSurf) B.grid(row=0, column=1, sticky=TK.EW) # - Get value from mouse - B = TTK.Button(Frame, image=iconics.PHOTO[8], command=getValueFromMouse, padx=0) B.grid(row=0, column=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Get value from mouse.') # - Extract - B = TTK.Button(Frame, text="Extract isosurf", command=extractIsoSurf) B.grid(row=1, column=0, columnspan=3, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Extract isosurf to SURFACES.')
def createApp(win): ttk = CTK.importTtk() # - Frame - Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE, text='tkStream', font=CTK.FRAMEFONT, takefocus=1) #BB = CTK.infoBulle(parent=Frame, text='Compute stream lines/surfaces.\nCtrl+c to close applet.', temps=0, btype=1) Frame.bind('<Control-c>', hideApp) Frame.bind('<ButtonRelease-3>', displayFrameMenu) Frame.bind('<Enter>', lambda event: Frame.focus_set()) Frame.columnconfigure(0, weight=1) Frame.columnconfigure(1, weight=1) Frame.columnconfigure(2, weight=1) WIDGETS['frame'] = Frame # - Frame menu - FrameMenu = TK.Menu(Frame, tearoff=0) FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp) FrameMenu.add_command(label='Save', command=saveApp) FrameMenu.add_command(label='Reset', command=resetApp) CTK.addPinMenu(FrameMenu, 'tkStream') WIDGETS['frameMenu'] = FrameMenu # - VARS - # -0- nptsmax - V = TK.StringVar(win) V.set('2000') VARS.append(V) if 'tkStreamNpts' in CTK.PREFS: V.set(CTK.PREFS['tkStreamNpts']) # -1- Var0 for vector - V = TK.StringVar(win) V.set('CoordinateX') VARS.append(V) # -2- Var1 for vector - V = TK.StringVar(win) V.set('CoordinateY') VARS.append(V) # -3- Var2 for vector - V = TK.StringVar(win) V.set('CoordinateZ') VARS.append(V) # - Menu des variables - F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[1], '') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList1) F.grid(row=0, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable 1.') WIDGETS['variable1'] = B else: B = ttk.Combobox(F, textvariable=VARS[1], values=[], state='readonly', width=10) B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList1_2) F.grid(row=0, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable 1.') WIDGETS['variable1'] = B F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[2], '') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList2) F.grid(row=0, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable 2.') WIDGETS['variable2'] = B else: B = ttk.Combobox(F, textvariable=VARS[2], values=[], state='readonly', width=10) B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList2_2) F.grid(row=0, column=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable 2.') WIDGETS['variable2'] = B F = TTK.Frame(Frame, borderwidth=0) F.columnconfigure(0, weight=1) if ttk is None: B = TK.OptionMenu(F, VARS[3], '') B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList3) F.grid(row=0, column=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable 3.') WIDGETS['variable3'] = B else: B = ttk.Combobox(F, textvariable=VARS[3], values=[], state='readonly', width=10) B.grid(sticky=TK.EW) F.bind('<Enter>', updateVarNameList3_2) F.grid(row=0, column=2, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Variable 3.') WIDGETS['variable3'] = B # - nptsmax - B = TTK.Label(Frame, text="nptsmax") B.grid(row=1, column=0, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Max number of points of streams.') B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=5) BB = CTK.infoBulle(parent=B, text='Max number of points of streams.') B.grid(row=1, column=1, columnspan=2, sticky=TK.EW) # - Stream line - B = TTK.Button(Frame, text="Line", command=streamLine) B.grid(row=2, column=0, columnspan=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Draw a stream line.') # - Stream ribbon - B = TTK.Button(Frame, text="Ribbon", command=streamRibbon) B.grid(row=2, column=1, columnspan=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Draw a stream ribbon.') # - Stream surface - B = TTK.Button(Frame, text="Surface", command=streamSurface) B.grid(row=2, column=2, columnspan=1, sticky=TK.EW) BB = CTK.infoBulle(parent=B, text='Draw a stream surface from a BAR.')