コード例 #1
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE,
                           text='tkFilterSurfs', font=CTK.FRAMEFONT, takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Filter or offset a surface.\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)
    Frame.columnconfigure(2, weight=2)
    Frame.columnconfigure(3, 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, 'tkFilterSurfs')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Point density -
    V = TK.StringVar(win); V.set('1.'); VARS.append(V)
    if 'tkFilterSurfsDensity' in CTK.PREFS: 
        V.set(CTK.PREFS['tkFilterSurfsDensity'])
    # -1- Offset -
    V = TK.StringVar(win); V.set('0.'); VARS.append(V)
    if 'tkFilterSurfsOffset' in CTK.PREFS: 
        V.set(CTK.PREFS['tkFilterSurfsOffset'])
    # -2- Algorithm cart/octree
    V = TK.StringVar(win); V.set('0'); VARS.append(V)
    if 'tkFilterSurfsType' in CTK.PREFS: 
        V.set(CTK.PREFS['tkFilterSurfsType'])

    # - Point density -
    B = TTK.Label(Frame, text="density/offset")
    B.grid(row=0, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=8)
    B.grid(row=0, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Point density (npts/length unit).')

    # - Offset -
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=8)
    B.grid(row=0, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Distance of surface offset.')

    # - Algorithm -
    B = TTK.Checkbutton(Frame, text='', variable=VARS[2])
    B.grid(row=0, column=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Toggle octree algorithm.')
    
    # - Remap -
    B = TTK.Button(Frame, text="Filter/offset", command=remap)
    BB = CTK.infoBulle(parent=B, text='Remap/offset a surface with a given spacing.')
    B.grid(row=2, column=0, columnspan=4, sticky=TK.EW)
コード例 #2
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkCells',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Per cell operation\non meshes.\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=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, 'tkCells')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- selection formula -
    V = TK.StringVar(win)
    V.set('')
    VARS.append(V)
    # -1- strict -
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)

    # - Cells suppress/refine -
    B = TTK.Button(Frame, text="Suppress cell mode", command=suppressCells)
    B.grid(row=0, column=0, columnspan=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Suppress selected cell.')
    WIDGETS['suppress'] = B
    B = TTK.Button(Frame, text="Refine cell mode", command=refineCells)
    B.grid(row=1, column=0, columnspan=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Refine selected cell (TRI mesh only).')
    WIDGETS['refine'] = B

    # - Select cells -
    B = TTK.Button(Frame, text="SelectCells", command=selectCells)
    B.grid(row=2, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Select cells that matches formula.')
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White')
    B.bind('<Return>', selectCells)
    BB = CTK.infoBulle(parent=B, text='Selection formula.')
    B.grid(row=2, column=1, sticky=TK.EW)
    B = TTK.Checkbutton(Frame, text='', variable=VARS[1])
    BB = CTK.infoBulle(parent=B, text='Strict/not strict selection.')
    B.grid(row=2, column=2, sticky=TK.EW)
コード例 #3
0
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)
コード例 #4
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkEffects',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Set anaglyph 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)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkEffects')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- cam view angle -
    V = TK.StringVar(win)
    V.set('50.')
    VARS.append(V)
    if 'tkEffectsAngle' in CTK.PREFS: V.set(CTK.PREFS['tkEffectsAngle'])
    # -1- Shadow
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    if 'tkEffectsShadow' in CTK.PREFS:
        V.set(CTK.PREFS['tkEffectsShadow'])
    # -2- DOF
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    if 'tkEffectsDOF' in CTK.PREFS: V.set(CTK.PREFS['tkEffectsDOF'])
    # -3- Light offset X info bulle
    V = TK.StringVar(win)
    V.set('Light offset in x.')
    VARS.append(V)
    # -4- Light offset Y info bulle
    V = TK.StringVar(win)
    V.set('Light offset in y.')
    VARS.append(V)
    # -5- Depth of field info bulle
    V = TK.StringVar(win)
    V.set('Depth of field power.')
    VARS.append(V)
    # -6- Gamma correction info bulle
    V = TK.StringVar(win)
    V.set('Gamma correction.')
    VARS.append(V)

    # - Camera angle -
    B = TTK.Button(Frame, text="Set Cam angle", command=setViewAngle)
    B.grid(row=0, column=0, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Set the camera view angle.')
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=5)
    B.grid(row=0, column=1, sticky=TK.EW)
    B.bind('<Return>', setViewAngle)
    BB = CTK.infoBulle(parent=B, text='Cam view angle (deg).')

    # - Light offset X -
    B = TTK.Scale(Frame,
                  from_=0,
                  to=100,
                  orient=TK.HORIZONTAL,
                  showvalue=0,
                  borderwidth=1,
                  command=setLightOffsetX,
                  value=55)
    WIDGETS['lightOffsetX'] = B
    B.grid(row=1, column=0, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, textVariable=VARS[3])

    # - Light offset Y -
    B = TTK.Scale(Frame,
                  from_=0,
                  to=100,
                  orient=TK.HORIZONTAL,
                  showvalue=0,
                  borderwidth=1,
                  command=setLightOffsetY,
                  value=25)
    WIDGETS['lightOffsetY'] = B
    B.grid(row=1, column=1, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, textVariable=VARS[4])

    # - DOF power -
    B = TTK.Scale(Frame,
                  from_=0,
                  to=100,
                  orient=TK.HORIZONTAL,
                  showvalue=0,
                  borderwidth=1,
                  command=setDofPower,
                  value=0)
    WIDGETS['dofPower'] = B
    B.grid(row=2, column=0, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, textVariable=VARS[5])

    # - Gamma correction -
    B = TTK.Scale(Frame,
                  from_=0,
                  to=100,
                  orient=TK.HORIZONTAL,
                  showvalue=0,
                  borderwidth=1,
                  command=setGammaCorrection,
                  value=50)
    WIDGETS['gammaCorrection'] = B
    B.grid(row=2, column=1, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, textVariable=VARS[6])

    # - Shadow + DOF -
    B = TTK.Checkbutton(Frame,
                        text='Shadow',
                        variable=VARS[1],
                        command=setShadow)
    BB = CTK.infoBulle(parent=B, text='Toggle shadows.')
    B.grid(row=3, column=0, sticky=TK.EW)
    B = TTK.Checkbutton(Frame,
                        text='DOF/Gamma',
                        variable=VARS[2],
                        command=setDOF)
    BB = CTK.infoBulle(parent=B,
                       text='Toggle depth of field blur/gamma correction.')
    B.grid(row=3, column=1, sticky=TK.EW)
コード例 #5
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE,
                           text='tkSmooth', font=CTK.FRAMEFONT, takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Smooth meshes.\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=0)
    Frame.columnconfigure(2, weight=0)
    Frame.columnconfigure(3, weight=0)
    Frame.columnconfigure(4, 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, 'tkSmooth')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Smoother niter -
    V = TK.StringVar(win); V.set('10'); VARS.append(V)
    if 'tkSmoothIter' in CTK.PREFS: V.set(CTK.PREFS['tkSmoothIter'])
    # -1- Constraint
    V = TK.StringVar(win); V.set(''); VARS.append(V)
    # -2- Constraint strength
    V = TK.StringVar(win); V.set('0.1'); VARS.append(V)
    if 'tkSmoothConsStrength' in CTK.PREFS: 
        V.set(CTK.PREFS['tkSmoothConsStrength'])
    # -3- Constraint external faces
    V = TK.IntVar(win); V.set(1); VARS.append(V)
    # -4- smooth eps
    V = TK.StringVar(win); V.set('0.5'); VARS.append(V)
    if 'tkSmoothEps' in CTK.PREFS: 
        V.set(CTK.PREFS['tkSmoothEps'])
    # -5- Constraint sharp edges
    V = TK.IntVar(win); V.set(0); VARS.append(V)
    # -6- Sharp edges detection angle
    V = TK.StringVar(win); V.set('30.'); VARS.append(V)
    if 'tkSmoothSharpAngle' in CTK.PREFS: 
        V.set(CTK.PREFS['tkSmoothSharpAngle'])
    # -7- Project on surface
    V = TK.IntVar(win); V.set(0); VARS.append(V)
    # -8- Type de smoothing
    V = TK.StringVar(win); V.set('Volume'); VARS.append(V)
    if 'tkSmoothType' in CTK.PREFS: 
        V.set(CTK.PREFS['tkSmoothType'])

    # - Smoother power -
    #B = TTK.Label(Frame, text="Eps")
    #B.grid(row=0, column=0, sticky=TK.EW)
    B = TTK.OptionMenu(Frame, VARS[8], 'Volume', 'Scale', 'Taubin')
    BB = CTK.infoBulle(parent=B, text='Smoothing algorithm.')
    B.grid(row=0, column=0, columnspan=2, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[4], background='White', width=4)
    B.grid(row=0, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Smoother power.')
    B = TTK.Label(Frame, text="Iter")
    B.grid(row=0, column=3, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=4)
    B.grid(row=0, column=4, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Number of smoother iterations.')

    # - Constraint strength -
    B = TTK.Entry(Frame, textvariable=VARS[2], background='White', width=4)
    B.grid(row=1, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Strength of constraints.')

    # - Keep external faces -
    B = TTK.Checkbutton(Frame, text='EF', variable=VARS[3])
    B.grid(row=1, column=1, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Keep external faces.')

    # - Keep sharp edges faces -
    B = TTK.Checkbutton(Frame, text='SE', variable=VARS[5])
    B.grid(row=1, column=2, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Keep sharp edges.')

    # - Project on surface
    B = TTK.Checkbutton(Frame, text='PJ', variable=VARS[7])
    B.grid(row=1, column=3, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Project on surface.')

    # - Sharp edges detection
    B = TTK.Entry(Frame, textvariable=VARS[6], background='White', width=4)
    B.grid(row=1, column=4, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Sharp edges detection angle.')

    # - Smoother constraint -
    B = TTK.Button(Frame, command=setConstraint,
                   image=iconics.PHOTO[8], padx=0, pady=0)
    BB = CTK.infoBulle(parent=B, text='Set constraint curves for smoother (points dont move).')
    B.grid(row=2, column=4, columnspan=1, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=8)
    B.grid(row=2, column=0, columnspan=4, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Constraint curves for smoother (points dont move).')
    
    # - Smooth -
    B = TTK.Button(Frame, text="Smooth", command=smooth)
    BB = CTK.infoBulle(parent=B, text='Smooth mesh.')
    B.grid(row=3, column=0, columnspan=5, sticky=TK.EW)
コード例 #6
0
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).')
コード例 #7
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkTime',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Manage time.\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, 'tkTime')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- t0 -
    V = TK.StringVar(win)
    V.set('0.')
    VARS.append(V)
    if 'tkTimeT0' in CTK.PREFS: V.set(CTK.PREFS['tkTimeT0'])
    # -1- t -
    V = TK.StringVar(win)
    V.set('0.5')
    VARS.append(V)
    # -2- tf -
    V = TK.StringVar(win)
    V.set('1.')
    VARS.append(V)
    if 'tkTimeTF' in CTK.PREFS: V.set(CTK.PREFS['tkTimeTF'])
    # -3- Show only BCWall
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    if 'tkTimeWall' in CTK.PREFS: V.set(CTK.PREFS['tkTimeWall'])
    # -4- time info bulle
    V = TK.StringVar(win)
    V.set('Time.')
    VARS.append(V)

    # - Times -
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=5)
    B.grid(row=0, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Starting time.')
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=5)
    B.grid(row=0, column=1, sticky=TK.EW)
    B.bind('<Return>', setTime)
    BB = CTK.infoBulle(parent=B, text='Current time.')
    WIDGETS['time'] = B
    B = TTK.Entry(Frame, textvariable=VARS[2], background='White', width=5)
    B.grid(row=0, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Final time.')

    # - Slider -
    B = TTK.Scale(Frame,
                  from_=0,
                  to=100,
                  orient=TK.HORIZONTAL,
                  showvalue=0,
                  borderwidth=1,
                  command=setSlider,
                  value=0)
    WIDGETS['slider'] = B
    B.grid(row=1, columnspan=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, textVariable=VARS[4])

    # - Options -
    B = TTK.Checkbutton(Frame,
                        text='Walls',
                        variable=VARS[3],
                        command=setWalls)
    BB = CTK.infoBulle(parent=B, text='Show only BCWalls.')
    B.grid(row=2, column=0, sticky=TK.EW)

    # - Play, stop -
    B = TTK.Button(Frame, text=">", command=playForward)
    B.grid(row=3, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Play forward.')

    B = TTK.Button(Frame, text="||", command=stop)
    B.grid(row=3, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Stop playing.')

    B = TTK.Button(Frame, text="<", command=playBackward)
    B.grid(row=3, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Play backward.')