コード例 #1
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkStereo',
                           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=0)
    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, 'tkStereo')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Stero mode -
    V = TK.StringVar(win)
    V.set('None')
    VARS.append(V)
    if 'tkStereoMode' in CTK.PREFS: V.set(CTK.PREFS['tkStereoMode'])
    # -1- Stereo dist info bulle
    V = TK.StringVar(win)
    V.set('Stereo distance.')
    VARS.append(V)

    # - Stereo mode -
    B = TTK.Label(Frame, text="Stereo")
    B.grid(row=0, column=0, sticky=TK.EW)
    B = TTK.OptionMenu(Frame,
                       VARS[0],
                       'None',
                       'Anaglyph (b&w)',
                       'Anaglyph (color)',
                       command=setStereo)
    B.grid(row=0, column=1, sticky=TK.EW)

    # - Stereo Dist -
    B = TTK.Scale(Frame,
                  from_=0,
                  to=100,
                  orient=TK.HORIZONTAL,
                  showvalue=0,
                  borderwidth=1,
                  command=setDist,
                  value=50)
    WIDGETS['dist'] = B
    B.grid(row=1, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, textVariable=VARS[1])
コード例 #2
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)
コード例 #3
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)
コード例 #4
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkDemo',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Demo 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=2)
    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, 'tkDemo')
    WIDGETS['frameMenu'] = FrameMenu

    # -0- Orbiter path -
    V = TK.StringVar(win)
    V.set('')
    VARS.append(V)

    # - Slider -
    B = TTK.Scale(Frame,
                  from_=0,
                  to=100,
                  orient=TK.HORIZONTAL,
                  showvalue=0,
                  borderwidth=1,
                  value=50)
    WIDGETS['speed'] = B
    B.grid(row=0, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Speed.')

    # - Rotate -
    B = TTK.Button(Frame, text="Rotate", command=rotate)
    B.grid(row=1, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Rotate your model automatically.')
    WIDGETS['rotate'] = B

    # - Fly -
    B = TTK.Button(Frame, text="Fly", command=fly)
    B.grid(row=1, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Fly around your model.')
    WIDGETS['fly'] = B

    # - Orbite -
    B = TTK.Button(Frame,
                   text="Path",
                   command=setPath,
                   image=iconics.PHOTO[8],
                   compound=TK.RIGHT,
                   padx=0,
                   pady=0)
    B.grid(row=2, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Set orbiter path.')
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White')
    B.grid(row=2, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Orbiter path (curve).')

    B = TTK.Button(Frame, text="Orbite", command=orbite)
    B.grid(row=3, column=0, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Orbite following a path.')
    WIDGETS['orbite'] = B
コード例 #5
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).')
コード例 #6
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.')
コード例 #7
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkSculpt',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Sculpt surfaces by deformations.', 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, 'tkSculpt')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- depth -
    V = TK.StringVar(win)
    V.set('1.')
    VARS.append(V)
    # -1- width -
    V = TK.StringVar(win)
    V.set('1.')
    VARS.append(V)
    # -2- Brush
    V = TK.StringVar(win)
    V.set('Deform')
    VARS.append(V)
    # -3- Negative/positive depth
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    # -4- Depth info bulle
    V = TK.StringVar(win)
    V.set('Depth.')
    VARS.append(V)
    # -5- Width info bulle
    V = TK.StringVar(win)
    V.set('Width.')
    VARS.append(V)

    # - Depth -
    B = TTK.Scale(Frame,
                  from_=0,
                  to=100,
                  orient=TK.HORIZONTAL,
                  showvalue=0,
                  command=setDepth,
                  borderwidth=1,
                  value=50)
    WIDGETS['depth'] = B
    B.grid(row=0, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, textVariable=VARS[4])
    #B = TK.Checkbutton(Frame, text='', variable=VARS[3])
    #BB = CTK.infoBulle(parent=B, text='Check for additive depth.')
    #B.grid(row=0, column=1, sticky=TK.EW)

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

    # - Brush -
    B = TTK.OptionMenu(Frame, VARS[2], 'Deform', 'Sphere')
    B.grid(row=2, column=0, sticky=TK.EW)

    # - Sculpt mode -
    B = TTK.Button(Frame, text="Sculpt mode", command=sculpt)
    BB = CTK.infoBulle(parent=B, text='Enter sculpt mode.')
    B.grid(row=2, column=1, columnspan=1, sticky=TK.EW)
    WIDGETS['sculpt'] = B
コード例 #8
0
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)