Exemplo n.º 1
0
def Configuration(parent,E):
# =================================================================
  ''' Interactive widget to modify the options of 2D contour plots'''

  __version__ = "1.0"
  __author__  = "Quim Ballabrerera"
  __date__    = "August 2020"

  font_bold = tkfont.Font(font='TkDefaultFont').copy()
  font_bold['weight']='bold'

  frame1 = ttk.Frame(parent,borderwidth=5,padding=5,relief='sunken')
  ttk.Label(frame1,text='Patch',font=font_bold).grid(row=0,column=0,sticky='w')
  ttk.Label(frame1,text='ALIAS:').grid(row=1,column=0,sticky='w')
  ttk.Label(frame1,text=E.ALIAS.get(),width=30).grid(row=1,column=1,sticky='w')
  frame1.grid()

  frame2 = ttk.Frame(parent,borderwidth=5,padding=5)

  ttk.Label(frame2,text='Line style:').grid(row=2,column=0,sticky='e')
  ttk.Entry(frame2,textvariable=E.PLOT.LINE_STYLE,width=10).grid(row=2,column=1,sticky='we')
  ttk.Label(frame2,text='Line width:').grid(row=3,column=0,sticky='e')
  ttk.Entry(frame2,textvariable=E.PLOT.LINE_WIDTH,width=10).grid(row=3,column=1,sticky='we')

  ttk.Label(frame2,text='Edge color:').grid(row=4,column=0,sticky='e')
  sclabel = ttk.Style()
  sclabel.configure("sclabel.TLabel",background=E.PLOT.LINE_COLOR.get(),anchor="center")
  ecol = ttk.Label(frame2,textvariable=E.PLOT.LINE_COLOR,width=8,style="sclabel.TLabel") # Map Contour Color
  ecol.grid(row=4,column=1,padx=3,sticky='we')
  ttk.Button(frame2,text='Select',command=lambda:colsel(E.PLOT.LINE_COLOR, \
            sclabel,ecol,"sclabel.TLabel",master=parent)).\
            grid(row=4,column=2,padx=3,sticky='ew')

  ttk.Label(frame2,text='Fill:').grid(row=5,column=0,sticky='e')
  tk.Checkbutton(frame2,variable=E.PLOT.FILL).grid(row=5,column=1,sticky='w')

  ttk.Label(frame2,text='Face color:').grid(row=6,column=0,sticky='e')
  scfacec = ttk.Style()
  scfacec.configure("scfacec.TLabel",background=E.PLOT.FACE_COLOR.get(),anchor="center")
  fcol = ttk.Label(frame2,textvariable=E.PLOT.FACE_COLOR,width=8,style="scfacec.TLabel") # Map Contour Color
  fcol.grid(row=6,column=1,padx=3,sticky='we')
  ttk.Button(frame2,text='Select',command=lambda:colsel(E.PLOT.FACE_COLOR, \
            scfacec,fcol,"scfacec.TLabel",master=parent)).\
            grid(row=6,column=2,padx=3,sticky='ew')

  #ttk.Label(frame2,text='Face color:').grid(row=6,column=0,columnspan=2,sticky='we')
  #tk.Checkbutton(frame2,variable=E.PLOT.FACE_COLOR).grid(row=6,column=2,sticky='w')
  ttk.Label(frame2,text='Angle:').grid(row=7,column=0,sticky='e')
  ttk.Entry(frame2,textvariable=E.PLOT.ANGLE,width=10).grid(row=7,column=1,sticky='we')
  ttk.Label(frame2,text='Alpha:').grid(row=8,column=0,sticky='e')
  ttk.Entry(frame2,textvariable=E.PLOT.ALPHA,width=10).grid(row=8,column=1,sticky='we')
  ttk.Label(frame2,text='Zorder:').grid(row=9,column=0,sticky='e')
  ttk.Entry(frame2,textvariable=E.PLOT.ZORDER,width=10).grid(row=9,column=1,sticky='we')
  frame2.grid()
Exemplo n.º 2
0
def Configuration(parent, PLOT):
    # ========================================
    ''' Interactive widget to modify the options of Dot plots'''

    __version__ = "1.0"
    __author__ = "Quim Ballabrerera"
    __date__ = "May 2018"

    # Main widget
    # ===========

    # Symbol list using standard and utf technical symbols
    #
    SYMBOL_LIST = ['.',',','o','v','^','<','>', \
                  '1','2','3','4','s','p','*',  \
                  'h','H','+','x','D','d','|','_']
    for n in range(ord('\u2600'), ord('\u26B8') + 1):
        SYMBOL_LIST.append(chr(n))

    font = tkfont.Font(font='TkDefaultFont').copy()
    F0 = ttk.Frame(parent, borderwidth=5, padding=5)
    ttk.Label(F0, text='Dot options', font=font).grid(row=0,
                                                      column=0,
                                                      sticky='w')
    tk.Checkbutton(F0,text='Show',font=font, \
                   variable=PLOT.SHOW).grid(row=1,column=1)
    ttk.Label(F0, text='Symbol').grid(row=2,
                                      column=0,
                                      columnspan=1,
                                      sticky='w')
    ttk.Combobox(F0,textvariable=PLOT.SYMBOL, \
                 values=SYMBOL_LIST,width=8).grid(row=2,column=1,sticky='w')
    ttk.Label(F0, text='Size').grid(row=3, column=0, sticky='w')
    ttk.Entry(F0, textvariable=PLOT.SIZE, width=8).grid(row=3,
                                                        column=1,
                                                        sticky='w')

    sdlabel = ttk.Style()
    sdlabel.configure("sdlabel.TLabel",
                      background=PLOT.COLOR.get(),
                      anchor="center")
    ttk.Label(F0, text='Color').grid(row=4, column=0, columnspan=1, sticky='w')
    DLabel = ttk.Label(F0,
                       textvariable=PLOT.COLOR,
                       width=8,
                       style="sdlabel.TLabel")
    DLabel.grid(row=4, column=1)
    ttk.Button(F0,text='Select',command=lambda:colsel(PLOT.COLOR, \
              sdlabel,DLabel,"sdlabel.TLabel",master=parent)).\
              grid(row=4,column=2,padx=3,sticky='ew')

    ttk.Label(F0,text='Alpha').grid(row=5,column=0, \
                                    columnspan=1,sticky='w')
    ttk.Entry(F0,textvariable=PLOT.ALPHA, \
              justify='left',width=8).grid(row=5,column=1,sticky='w')
    #ttk.Label(F0,text='Label').grid(row=6,column=0,columnspan=1,sticky='w')
    #ttk.Entry(F0,textvariable=PLOT.LABEL, \
    #          justify='left',width=20).grid(row=6,column=1, \
    #                                        columnspan=2,sticky='w')
    F0.grid()
Exemplo n.º 3
0
def Configuration(parent, PLOT):
    # ========================================
    ''' Interactive widget to modify the options of 2D vector plots'''

    __version__ = "1.1"
    __author__ = "Quim Ballabrerera"
    __date__ = "December 2017"

    def switchframes():
        # =================
        if PLOT.DRAWING_MODE.get() == 0:
            nb.select(page1)
        elif PLOT.DRAWING_MODE.get() == 1:
            nb.select(page2)
        else:
            nb.select(page3)

    font_bold = tkfont.Font(font='TkDefaultFont').copy()
    font_bold['weight'] = 'bold'

    frame0 = ttk.Frame(parent, borderwidth=10, padding=2, relief='raised')
    ttk.Radiobutton(frame0,
                    text='Quiver plot',
                    variable=PLOT.DRAWING_MODE,
                    command=switchframes,
                    value=0).grid(row=0, column=0, columnspan=2, padx=5)
    ttk.Radiobutton(frame0,
                    text='Barbs plot',
                    variable=PLOT.DRAWING_MODE,
                    command=switchframes,
                    value=1).grid(row=0, column=2, columnspan=2, padx=5)
    ttk.Radiobutton(frame0,
                    text='Streamlines plot',
                    variable=PLOT.DRAWING_MODE,
                    command=switchframes,
                    value=2).grid(row=0, column=4, columnspan=2, padx=5)
    frame0.grid()

    frame = ttk.Frame(parent, borderwidth=5, padding=5)
    ttk.Label(frame,text='Currents grid Mode',font=font_bold)\
        .grid(row=0,column=0,columnspan=4,sticky='ew')

    fleft = ttk.Frame(frame, padding=15)

    ttk.Label(fleft,text='Original Grid').grid(row=0, \
                                               column=0, \
                                               columnspan=1,
                                               sticky='we')
    ttk.Radiobutton(fleft, variable=PLOT.GRID_MODE, value=0).grid(row=0,
                                                                  column=1,
                                                                  sticky='w')
    ttk.Label(fleft, text='X stride', width=10).grid(row=1,
                                                     column=0,
                                                     padx=3,
                                                     sticky='w')
    ttk.Entry(fleft, textvariable=PLOT.CURRENT_DX, width=7).grid(row=1,
                                                                 column=1,
                                                                 padx=3,
                                                                 sticky='e')
    ttk.Label(fleft, text='Y stride', width=10).grid(row=2,
                                                     column=0,
                                                     columnspan=1,
                                                     padx=3,
                                                     sticky='w')
    ttk.Entry(fleft, textvariable=PLOT.CURRENT_DY, width=7).grid(row=2,
                                                                 column=1,
                                                                 padx=3,
                                                                 sticky='e')
    fleft.grid(row=1, rowspan=3, column=0, columnspan=2, padx=3)

    fright = ttk.Frame(frame, padding=15)
    ttk.Label(fright,text='Interpolated Grid').grid(row=0, \
                                               column=0, \
                                               columnspan=1,
                                               sticky='we')
    ttk.Radiobutton(fright,\
                    variable=PLOT.GRID_MODE,
                    value=1).grid(row=0,column=1,sticky='w')
    ttk.Label(fright, text='Number X points', width=15).grid(row=1,
                                                             column=0,
                                                             padx=3,
                                                             sticky='w')
    ttk.Entry(fright, textvariable=PLOT.CURRENT_NX, width=7).grid(row=1,
                                                                  column=1,
                                                                  sticky='e',
                                                                  padx=3)
    ttk.Label(fright, text='Number Y points', width=15).grid(row=6,
                                                             column=0,
                                                             columnspan=1,
                                                             padx=3,
                                                             sticky='w')
    ttk.Entry(fright, textvariable=PLOT.CURRENT_NY, width=7).grid(row=6,
                                                                  column=1,
                                                                  sticky='e',
                                                                  padx=3)
    fright.grid(row=1, rowspan=3, column=2, columnspan=2)
    frame.grid()

    # Define tabs:
    nb = ttk.Notebook(parent)
    page1 = ttk.Frame(nb)
    page2 = ttk.Frame(nb)
    page3 = ttk.Frame(nb)
    nb.add(page1, text='Quiver options')
    nb.add(page2, text='Barbs options')
    nb.add(page3, text='Streamlines options')
    nb.grid()

    frame1 = ttk.Frame(page1, borderwidth=5, padding=5)
    salabel = ttk.Style()
    salabel.configure("salabel.TLabel",
                      background=PLOT.CURRENT_COLOR.get(),
                      anchor="center")

    ttk.Label(frame1, text='Arrow options', font=font_bold).grid(row=0,
                                                                 column=0,
                                                                 sticky='w')
    ttk.Label(frame1, text='Scale').grid(row=1, column=0, sticky='w')
    ttk.Entry(frame1, textvariable=PLOT.CURRENT_SCALE,
              width=8).grid(row=1, column=1, sticky='w')
    ttk.Label(frame1, text='Width').grid(row=2, column=0, sticky='w')
    ttk.Entry(frame1, textvariable=PLOT.CURRENT_WIDTH,
              width=8).grid(row=2, column=1, sticky='w')
    ttk.Label(frame1, text='Head length').grid(row=3,
                                               column=0,
                                               columnspan=1,
                                               sticky='w')
    ttk.Entry(frame1,
              textvariable=PLOT.CURRENT_HEADLENGTH,width=8). \
              grid(row=3,column=1,sticky='w')
    ttk.Label(frame1, text='Head width').grid(row=4,
                                              column=0,
                                              columnspan=1,
                                              sticky='w')
    ttk.Entry(frame1, textvariable=PLOT.CURRENT_HEADWIDTH,
              width=8).grid(row=4, column=1, sticky='w')
    ttk.Label(frame1, text='Color').grid(row=5,
                                         column=0,
                                         columnspan=1,
                                         sticky='w')
    ALabel = ttk.Label(frame1,
                       textvariable=PLOT.CURRENT_COLOR,
                       width=8,
                       style="salabel.TLabel")
    ALabel.grid(row=5, column=1)
    ttk.Button(frame1,text='Select',command=lambda:colsel(PLOT.CURRENT_COLOR, \
              salabel,ALabel,"salabel.TLabel",master=parent)).grid(row=5,column=2)
    ttk.Label(frame1, text='Additional arguments',
              font=font_bold).grid(row=6, column=0, sticky='w', pady=[10, 1])
    ttk.Label(frame1, text='Alpha').grid(row=7,
                                         column=0,
                                         columnspan=1,
                                         sticky='w')
    ttk.Entry(frame1, textvariable=PLOT.ALPHA, justify='left',
              width=8).grid(row=7, column=1, sticky='w')
    ttk.Label(frame1, text='Zorder').grid(row=8,
                                          column=0,
                                          columnspan=1,
                                          sticky='w')
    ttk.Entry(frame1,
              textvariable=PLOT.ZORDER,
              justify='left',width=8). \
              grid(row=8,column=1,sticky='w')
    frame1.grid()

    frame2 = ttk.Frame(page1, borderwidth=5, padding=5)
    sklabel = ttk.Style()
    sklabel.configure("sklabel.TLabel",
                      background=PLOT.KEY_COLOR.get(),
                      anchor="center")
    ttk.Label(frame2, text='Current Key', font=font_bold).grid(row=0,
                                                               column=0,
                                                               sticky='w')
    tk.Checkbutton(frame2,text='Show',variable=PLOT.KEY_SHOW,\
                          font=font_bold).grid(row=0,column=2)
    ttk.Label(frame2, text='Label').grid(row=1, column=0, sticky='w')
    ttk.Entry(frame2,textvariable=PLOT.KEY_LABEL, \
                     width=20).grid(row=1,column=1,columnspan=2,sticky='w')
    ttk.Label(frame2, text='Value').grid(row=2,
                                         column=0,
                                         columnspan=1,
                                         sticky='w')
    ttk.Entry(frame2,textvariable=PLOT.KEY_VALUE, \
                     width=8).grid(row=2,column=1,sticky='w')

    def getpos():
        # ===========
        PLOT.KEY_GETXY = True

    ttk.Label(frame2, text='X').grid(row=3, column=0, columnspan=1, sticky='w')
    ttk.Entry(frame2,textvariable=PLOT.KEY_X, \
                     width=8).grid(row=3,column=1,sticky='w')
    ttk.Button(frame2, text='Select', command=getpos).grid(row=3, column=2)
    ttk.Label(frame2, text='Y').grid(row=4, column=0, sticky='w')
    ttk.Entry(frame2,textvariable=PLOT.KEY_Y, \
                     width=8).grid(row=4,column=1,sticky='w')
    ttk.Label(frame2, text='Label side').grid(row=5, column=0, sticky='w')
    ttk.Entry(frame2,textvariable=PLOT.KEY_POS, \
                     width=8).grid(row=5,column=1,sticky='w')
    ttk.Label(frame2, text='Label color').grid(row=6, column=0, sticky='w')
    KLabel = ttk.Label(frame2,
                       textvariable=PLOT.KEY_COLOR,
                       width=8,
                       style="sklabel.TLabel")
    KLabel.grid(row=6, column=1, sticky='w')
    ttk.Button(frame2,text='Select',command=lambda:colsel(PLOT.KEY_COLOR, \
              salabel,KLabel,"sklabel.TLabel",master=parent)). \
              grid(row=6,column=2,sticky='w')
    ttk.Label(frame2, text='Label size').grid(row=7, column=0, sticky='w')
    ttk.Entry(frame2,textvariable=PLOT.KEY_SIZE,width=8). \
              grid(row=7,column=1,sticky='w')
    frame2.grid(row=9, column=0)

    frame5 = ttk.Frame(page2, borderwidth=5, padding=5)

    sbalabel, sfllabel = ttk.Style(), ttk.Style()
    sbalabel.configure("sbalabel.TLabel",
                       background=PLOT.BARB_BARBCOLOR.get(),
                       anchor="center")
    sfllabel.configure("sfllabel.TLabel",
                       background=PLOT.BARB_FLAGCOLOR.get(),
                       anchor="center")
    ttk.Label(frame5, text='Barb options', font=font_bold).grid(row=0,
                                                                column=0,
                                                                sticky='w')
    ttk.Label(frame5, text='Length').grid(row=1, column=0, sticky='w')
    ttk.Entry(frame5, textvariable=PLOT.BARB_LENGTH, width=8).grid(row=1,
                                                                   column=1,
                                                                   sticky='w')
    ttk.Label(frame5, text='Pivot').grid(row=2, column=0, sticky='w')
    ttk.Combobox(frame5,
                 textvariable=PLOT.BARB_PIVOT,
                 width=8,
                 values=['tip', 'middle']).grid(row=2, column=1, sticky='w')
    ttk.Label(frame5,\
              text='Barbcolor').grid(row=3,column=0,sticky='w')
    BLabel = ttk.Label(frame5,
                       textvariable=PLOT.BARB_BARBCOLOR,
                       width=8,
                       style="sbalabel.TLabel")
    BLabel.grid(row=3, column=1, sticky='w')
    ttk.Button(frame5,text='Select',command=lambda:colsel(PLOT.BARB_BARBCOLOR, \
              sbalabel,BLabel,"sbalabel.TLabel",master=parent)). \
              grid(row=3,column=2,sticky='w')
    ttk.Label(frame5, text='Flagcolor').grid(row=4, column=0, sticky='w')
    FLabel = ttk.Label(frame5,
                       textvariable=PLOT.BARB_FLAGCOLOR,
                       width=8,
                       style="sfllabel.TLabel")
    FLabel.grid(row=4, column=1, sticky='w')
    ttk.Button(frame5,text='Select',command=lambda:colsel(PLOT.BARB_FLAGCOLOR, \
              sfllabel,FLabel,"sfllabel.TLabel",master=parent)). \
              grid(row=4,column=2,sticky='w')

    ttk.Label(frame5, text='Linewidth').grid(row=5, column=0, sticky='w')
    ttk.Entry(frame5, textvariable=PLOT.BARB_LINEWIDTH,
              width=7).grid(row=5, column=1, sticky='w')
    ttk.Label(frame5, text='Barb increments',
              font=font_bold).grid(row=6, column=0, sticky='w', pady=[10, 1])
    ttk.Label(frame5, text='Half').grid(row=7, column=0, sticky='w')
    ttk.Entry(frame5, textvariable=PLOT.BARB_HALF, width=7).grid(row=7,
                                                                 column=1,
                                                                 sticky='w')
    ttk.Label(frame5, text='Full').grid(row=8, column=0, sticky='w')
    ttk.Entry(frame5, textvariable=PLOT.BARB_FULL, width=7).grid(row=8,
                                                                 column=1,
                                                                 sticky='w')
    ttk.Label(frame5, text='Flag').grid(row=9, column=0, sticky='w')
    ttk.Entry(frame5, textvariable=PLOT.BARB_FLAG, width=7).grid(row=9,
                                                                 column=1,
                                                                 sticky='w')
    ttk.Label(frame5, text='Barb sizes', font=font_bold).grid(row=10,
                                                              column=0,
                                                              sticky='w',
                                                              pady=[10, 1])
    ttk.Label(frame5, text='Spacing').grid(row=11, column=0, sticky='w')
    ttk.Entry(frame5, textvariable=PLOT.BARB_SPACING, width=7).grid(row=11,
                                                                    column=1,
                                                                    sticky='w')
    ttk.Label(frame5, text='Height').grid(row=12, column=0, sticky='w')
    ttk.Entry(frame5, textvariable=PLOT.BARB_HEIGHT, width=7).grid(row=12,
                                                                   column=1,
                                                                   sticky='w')
    ttk.Label(frame5, text='Width').grid(row=13, column=0, sticky='w')
    ttk.Entry(frame5, textvariable=PLOT.BARB_WIDTH, width=7).grid(row=13,
                                                                  column=1,
                                                                  sticky='w')
    ttk.Label(frame5, text='Emptybarb').grid(row=14, column=0, sticky='w')
    ttk.Entry(frame5, textvariable=PLOT.BARB_EMPTYBARB,
              width=7).grid(row=14, column=1, sticky='w')
    ttk.Label(frame5, text='Additional arguments',
              font=font_bold).grid(row=15, column=0, sticky='w', pady=[10, 1])
    ttk.Label(frame5, text='Alpha').grid(row=16, column=0, sticky='w')
    ttk.Entry(frame5, textvariable=PLOT.ALPHA, width=7).grid(row=16,
                                                             column=1,
                                                             sticky='w')
    ttk.Label(frame5, text='Zorder').grid(row=17, column=0, sticky='w')
    ttk.Entry(frame5, textvariable=PLOT.ZORDER, width=7).grid(row=17,
                                                              column=1,
                                                              sticky='w')
    ttk.Label(frame5, text='Scale factor').grid(row=18, column=0, sticky='w')
    ttk.Entry(frame5, textvariable=PLOT.BARB_SCALE, width=10).grid(row=18,
                                                                   column=1,
                                                                   sticky='w')
    ttk.Label(frame5,
              text=' To convert to knots (If data '+ \
                     'in m/s: 1.9438445)').grid(row=18,
                                               column=2,
                                               columnspan=3,
                                               sticky='ew')
    frame5.grid()

    frame3 = ttk.Frame(page3, borderwidth=5, padding=5)
    sstlabel = ttk.Style()
    sstlabel.configure("sstlabel.TLabel",
                       background=PLOT.STREAM_COLOR.get(),
                       anchor="center")
    ttk.Label(frame3,text='Stream line options', \
                     font=font_bold).grid(row=0,column=0,sticky='w')
    ttk.Label(frame3, text='Density').grid(row=1, column=0, sticky='w')
    ttk.Entry(frame3,textvariable=PLOT.STREAM_DENSITY, \
                     width=8).grid(row=1,column=1,sticky='w')
    ttk.Label(frame3, text='Width').grid(row=2, column=0, sticky='w')
    ttk.Entry(frame3,textvariable=PLOT.STREAM_WIDTH, \
                     width=8).grid(row=2,column=1,sticky='w')

    ttk.Label(frame3, text='Color').grid(row=3,
                                         column=0,
                                         columnspan=1,
                                         sticky='w')
    STLabel = ttk.Label(frame3,
                        textvariable=PLOT.STREAM_COLOR,
                        width=8,
                        style="sstlabel.TLabel")
    STLabel.grid(row=3, column=1, padx=3, sticky='w')
    ttk.Button(frame3,
              text='Select',command=lambda:colsel(PLOT.STREAM_COLOR, \
              sstlabel,STLabel,"sstlabel.TLabel",master=parent)). \
              grid(row=3,column=2,padx=3)
    ttk.Label(frame3, text='Additional arguments',
              font=font_bold).grid(row=4, column=0, sticky='w', pady=[10, 1])
    ttk.Label(frame3, text='Zorder').grid(row=5, column=0, sticky='w')
    ttk.Entry(frame3, textvariable=PLOT.ZORDER, width=7).grid(row=5,
                                                              column=1,
                                                              sticky='w')
    frame3.grid()

    frame6 = ttk.Frame(parent, borderwidth=5, padding=5)
    ttk.Label(frame6,text='Color given by speed', \
              font=font_bold).grid(row=0,column=0,columnspan=2,padx=3,sticky='w')
    ttk.Checkbutton(frame6, variable=PLOT.COLOR_BY_SPEED).grid(row=0,
                                                               column=2,
                                                               padx=3)
    frame6.grid()

    switchframes()
Exemplo n.º 4
0
  def Winconfig(self,parent):
  # =========================

    LEGEND_LOCATION_LIST = ['best','upper right','upper left','lower left', \
                     'lower right', 'right', 'center left', 'center right', \
                     'lower center', 'upper center', 'center']
    LEGEND_MODE_LIST = ['None','expand']

    def legend_location():
    # =============
      ''' Process the location combobox'''
      location_name = loc.get()
      self.LOC.set(LEGEND_LOCATION_LIST.index(location_name))

    def legend_mode():
    # =============
      ''' Process the location combobox'''
      mode_name = mod.get()
      self.MODE.set(LEGEND_MODE_LIST.index(mode_name))

    f5 = ttk.Frame(parent,borderwidth=5,padding=5)
    ttk.Label(f5,text='Show').grid(row=0,column=0,padx=3)
    ttk.Checkbutton(f5,variable=self.SHOW).grid(row=0,
                                             column=1,
                                             padx=3,
                                             sticky='w')
    f5.grid()

    f6 = ttk.Frame(parent,borderwidth=5,padding=5)
    ttk.Label(f6,
              text='Legend title').grid(row=10,column=0,padx=3)
    ttk.Entry(f6,
              textvariable=self.TITLE,
              width=30).grid(row=10,column=1,columnspan=2,padx=3,sticky='w')

    def titleprop():
      self.TITLEFONT = fontconfig(font=self.TITLEFONT,
                                          sample=self.TITLE.get())

    ttk.Label(f6,text='Title font').grid(row=11,column=0,padx=3)
    ttk.Button(f6,text='View',
               command=titleprop).grid(row=11,column=1,padx=3)
    f6.grid()

    def _xyselec():
    # -------------
      self.GET_XY = True

    f7 = ttk.Frame(parent,borderwidth=5,padding=5)
    ttk.Label(f7,text='Use Anchoring BBox').grid(row=0,column=0,padx=3)
    ttk.Checkbutton(f7,variable=self.USE_BB).grid(row=0,column=1,padx=3)
    ttk.Label(f7,text='BB x coordinate:').grid(row=1,column=0,padx=3)
    ttk.Entry(f7,textvariable=self.BBx,width=10).grid(row=1,column=1,padx=3,sticky='w')
    ttk.Label(f7,text='BB y coordinate:').grid(row=2,column=0,padx=3)
    ttk.Entry(f7,textvariable=self.BBy,width=10).grid(row=2,column=1,padx=3,sticky='w')
    ttk.Button(f7,text='Select',command=_xyselec).grid(row=2,column=3,padx=3)

    ttk.Label(f7,text='Location').grid(row=3,column=0,padx=3)
    loc = ttk.Combobox(f7,values=LEGEND_LOCATION_LIST)
    loc.grid(row=3,column=1,padx=3,sticky='w')
    loc.set(LEGEND_LOCATION_LIST[self.LOC.get()])
    loc.bind('<<ComboboxSelected>>',lambda e: legend_location())

    ttk.Label(f7,text='Num columns').grid(row=4,column=0,padx=3)
    ttk.Entry(f7,textvariable=self.NCOL,width=10).grid(row=4,column=1,padx=3,sticky='w')

    ttk.Label(f7,text='MODE').grid(row=5,column=0,padx=3)
    mod = ttk.Combobox(f7,values=LEGEND_MODE_LIST)
    mod.grid(row=5,column=1,padx=3,sticky='w')
    mod.set(LEGEND_MODE_LIST[self.MODE.get()])
    mod.bind('<<ComboboxSelected>>',lambda e: legend_mode())
    f7.grid()

    f8 = ttk.Frame(parent,borderwidth=5,padding=5)
    ttk.Label(f8,text='Font size').grid(row=0,
                                     column=0,
                                     padx=3)
    ttk.Entry(f8,textvariable=self.FONTSIZE,
              width=10).grid(row=0,
                             column=1,
                             padx=3,
                             sticky='w')
    ttk.Label(f8,text='Default: < 1').grid(row=0,
                                        column=2,
                                        padx=3,
                                        sticky='w')

    ttk.Label(f8,text='Marker scale').grid(row=1,
                                     column=0,
                                     padx=3)
    ttk.Entry(f8,textvariable=self.MARKERSCALE,
              width=10).grid(row=1,
                             column=1,
                             padx=3,
                             sticky='w')
    ttk.Label(f8,text='Label spacing').grid(row=2,
                                     column=0,
                                     padx=3)
    ttk.Entry(f8,textvariable=self.LABELSPACING,
              width=10).grid(row=2,
                             column=1,
                             padx=3,
                             sticky='w')
    ttk.Label(f8,text='Handle text pad').grid(row=3,
                                     column=0,
                                     padx=3)
    ttk.Entry(f8,textvariable=self.HANDLETEXTPAD,
              width=10).grid(row=3,
                             column=1,
                             padx=3,
                             sticky='w')
    ttk.Label(f8,
              text='Border pad spacing').grid(row=4,
                                     column=0,
                                     padx=3)
    ttk.Entry(f8,
              textvariable=self.BORDERPAD,
              width=10).grid(row=4,
                             column=1,
                             padx=3,
                             sticky='w')
    ttk.Label(f8,
              text='Border axes pad').grid(row=5,
                                     column=0,
                                     padx=3)
    ttk.Entry(f8,
              textvariable=self.BORDERAXESPAD,
              width=10).grid(row=5,
                             column=1,
                             padx=3,
                             sticky='w')
    f8.grid()

    f9 = ttk.Frame(parent,borderwidth=5,padding=5)
    self.slflabel, self.slelabel = ttk.Style(), ttk.Style()
    self.slflabel.configure("slflabel.TLabel",background=self.COLOR.get(),anchor="center")
    self.slelabel.configure("slelabel.TLabel",background=self.EDGECOLOR.get(),anchor="center")
    ttk.Label(f9,text='Show frame').grid(row=5,column=0,padx=3)
    ttk.Checkbutton(f9,variable=self.FRAMEON).grid(row=5,column=1,padx=3,sticky='w')
    ttk.Label(f9,text='Fancy box').grid(row=6,column=0,padx=3)
    ttk.Checkbutton(f9,variable=self.FANCYBOX).grid(row=6,column=1,padx=3,sticky='w')
    ttk.Label(f9,text='Frame shadow').grid(row=7,column=0,padx=3)
    ttk.Checkbutton(f9,variable=self.SHADOW).grid(row=7,column=1,padx=3,sticky='w')
    
    ttk.Label(f9,text='Frame color').grid(row=8,column=0,padx=3)
    self.LFLabel = ttk.Label(f9,textvariable=self.COLOR,width=7,style="slflabel.TLabel")
    self.LFLabel.grid(row=8,column=1,padx=3)
    ttk.Button(f9,text='Select',command=lambda:colsel(self.COLOR, \
            self.slflabel,self.LFLabel,"slflabel.TLabel",master=parent)). \
            grid(row=8,column=2,padx=3)

    ttk.Label(f9,text='Edge color').grid(row=9,column=0,padx=3)
    self.LELabel = ttk.Label(f9,textvariable=self.EDGECOLOR,width=7,style="slelabel.TLabel")
    self.LELabel.grid(row=9,column=1,padx=3)
    ttk.Button(f9,text='Select',command=lambda:colsel(self.EDGECOLOR, \
            self.slelabel,self.LELabel,"slelabel.TLabel",master=parent)).   \
            grid(row=9,column=2,padx=3)
            
    ttk.Label(f9,text='Frame alpha').grid(row=10,column=0,padx=3)
    ttk.Entry(f9,textvariable=self.ALPHA,width=10).grid(row=10,column=1,padx=3,sticky='w')
    f9.grid()
Exemplo n.º 5
0
def Configuration(parent,varname,units,missing,minval,maxval,PLOT):
# ======================================================================
  ''' Interactive widget to modify the options of 2D contour plots'''

  __version__ = "1.0"
  __author__  = "Quim Ballabrerera"
  __date__    = "June 2017"

  def mselection():
  # ===============
    ''' Color picker with backup'''
    if PLOT.CONTOUR_COLORMAP.get() == 'None':
      name = colormap_selector(parent=parent)
    else:
      name = colormap_selector(cmap=PLOT.CONTOUR_COLORMAP.get(),parent=parent)
    PLOT.CONTOUR_COLORMAP.set(name)

  frame1 = ttk.Frame(parent,borderwidth=5,padding=5,relief='sunken')
  ttk.Label(frame1,text='Contour field',font='Helvetica 12 bold').grid(row=0,column=0,sticky='w')
  ttk.Label(frame1,text='Variable Name:').grid(row=1,column=0,sticky='w')
  ttk.Label(frame1,text=varname,width=30).grid(row=1,column=1,sticky='w')
  ttk.Label(frame1,text='Units:').grid(row=2,column=0,sticky='w')
  ttk.Label(frame1,text=units,width=30).grid(row=2,column=1,sticky='w')
  ttk.Label(frame1,text='Missing value:').grid(row=3,column=0,sticky='w')
  ttk.Label(frame1,text=missing,width=30).grid(row=3,column=1,sticky='w')
  ttk.Label(frame1,text='Minimum value:').grid(row=4,column=0,sticky='w')
  ttk.Label(frame1,text=minval,width=30).grid(row=4,column=1,sticky='w')
  ttk.Label(frame1,text='Maximum value:').grid(row=5,column=0,sticky='w')
  ttk.Label(frame1,text=maxval,width=30).grid(row=5,column=1,sticky='w')
  frame1.grid()

  frame0 = ttk.Frame(parent,borderwidth=10,padding=2,relief='raised')
  ttk.Radiobutton(frame0,text='Line contour',variable=PLOT.CONTOUR_MODE,value=0).grid(row=0,column=0,columnspan=2)
  ttk.Radiobutton(frame0,text='Filled contour',variable=PLOT.CONTOUR_MODE,value=1).grid(row=0,column=2,columnspan=2)
  ttk.Radiobutton(frame0,text='Pseudo-color',variable=PLOT.CONTOUR_MODE,value=2).grid(row=0,column=4,columnspan=2)
  frame0.grid()

  frame2 = ttk.Frame(parent,borderwidth=5,padding=5)
  ttk.Label(frame2,text='Contour minimum:').grid(row=0,column=0,sticky='w')
  ttk.Entry(frame2,textvariable=PLOT.CONTOUR_MIN,width=20).grid(row=0,column=1)
  tk.Checkbutton(frame2,text='Plot Log10',variable=PLOT.CONTOUR_LOG).grid(row=0,column=2,sticky='w')
  ttk.Label(frame2,text='Contour maximum:').grid(row=1,column=0,sticky='w')
  ttk.Entry(frame2,textvariable=PLOT.CONTOUR_MAX,width=20).grid(row=1,column=1)
  ttk.Label(frame2,text='Contour interval:').grid(row=2,column=0,sticky='w')
  ttk.Entry(frame2,textvariable=PLOT.CONTOUR_INTERVAL,width=20).grid(row=2,column=1)
  ttk.Label(frame2,text='Line width:').grid(row=3,column=0,sticky='w')
  ttk.Entry(frame2,textvariable=PLOT.CONTOUR_WIDTH,width=7).grid(row=3,column=1,sticky='w')
  tk.Checkbutton(frame2,text='Dashed Negative',variable=PLOT.CONTOUR_DASHEDNEG).grid(row=3,column=2,sticky='w')

  ccol = ttk.Radiobutton(frame2,text='Color',variable=PLOT.CONTOUR_LINEMODE,value='C')
  cmap = ttk.Radiobutton(frame2,text='Colormap',variable=PLOT.CONTOUR_LINEMODE,value='M')
  ccol.grid(row=4,column=0,sticky='w')
  cmap.grid(row=5,column=0,sticky='w')
  
  sclabel = ttk.Style()
  sclabel.configure("sclabel.TLabel",background=PLOT.CONTOUR_COLOR.get(),anchor="center")
  ecol = ttk.Label(frame2,textvariable=PLOT.CONTOUR_COLOR,width=8,style="sclabel.TLabel") # Map Contour Color
  ecol.grid(row=4,column=1,padx=3,sticky='we')
  ttk.Button(frame2,text='Select',command=lambda:colsel(PLOT.CONTOUR_COLOR, \
            sclabel,ecol,"sclabel.TLabel",master=parent)).\
            grid(row=4,column=2,padx=3,sticky='ew')    
  
  emap = ttk.Entry(frame2,textvariable=PLOT.CONTOUR_COLORMAP,justify='left',width=7)  # Map Contour Color
  emap.grid(row=5,column=1,padx=3,sticky='we')
  ttk.Button(frame2,text='Select',command=mselection).grid(row=5,column=2,padx=3,sticky='ew')
  tk.Checkbutton(frame2,text='Reverse',variable=PLOT.CONTOUR_REVERSE).grid(row=5,column=3,sticky='w')
  ttk.Label(frame2,text='Alpha:').grid(row=6,column=0,sticky='w')
  ttk.Entry(frame2,textvariable=PLOT.ALPHA,width=7).grid(row=6,column=1,sticky='w')
  ttk.Label(frame2,text='Zorder:').grid(row=7,column=0,sticky='w')
  ttk.Entry(frame2,textvariable=PLOT.ZORDER,width=7).grid(row=7,column=1,sticky='w')
  #ttk.Label(frame2,text='0: transparent; 1: opaque').grid(row=6,column=2,sticky='w')
  frame2.grid()

  frame3 = ttk.Frame(parent,borderwidth=5,padding=5)
  tk.Checkbutton(frame3,text='Show labels',variable=PLOT.LABEL_SHOW).grid(row=0,column=0,sticky='w')
  lall = ttk.Radiobutton(frame3,text='All',variable=PLOT.LABEL_SET,value='A')
  lset = ttk.Radiobutton(frame3,text='Values',variable=PLOT.LABEL_SET,value='V')
  lall.grid(row=1,column=1,sticky='w')
  lset.grid(row=2,column=1,sticky='w')
  ttk.Entry(frame3,textvariable=PLOT.LABEL_VALUES,width=30).grid(row=2,column=2,sticky='w')
  ttk.Label(frame3,text='e.g.: 20,21,...',width=15).grid(row=2,column=3,sticky='w')
  ttk.Label(frame3,text='Label size:').grid(row=3,column=1,sticky='w')
  ttk.Entry(frame3,textvariable=PLOT.LABEL_SIZE,width=7).grid(row=3,column=2,sticky='w')
  ttk.Label(frame3,text='Label format:').grid(row=4,column=1,sticky='w')
  ttk.Entry(frame3,textvariable=PLOT.LABEL_FORMAT,width=7).grid(row=4,column=2,sticky='w')
  ttk.Label(frame3,text='e.g.: {:.0f} ',width=15).grid(row=4,column=3,sticky='w')

  tk.Checkbutton(frame3,text='Show colorbar',variable=PLOT.COLORBAR_SHOW).grid(row=6,column=0,sticky='w')
  ttk.Label(frame3,text='Label').grid(row=7,column=1,sticky='w')
  tk.Entry(frame3,textvariable=PLOT.COLORBAR_LABEL,width=30).grid(row=7,column=2,sticky='w')
  ttk.Label(frame3,text='Labelpad').grid(row=8,column=1,sticky='w')
  tk.Entry(frame3,textvariable=PLOT.COLORBAR_LABELPAD,width=7).grid(row=8,column=2,sticky='w')
  ttk.Label(frame3,text='Location').grid(row=9,column=1,sticky='w')
  cb = ttk.Combobox(frame3,textvariable=PLOT.COLORBAR_LOCATION,width=12)
  cb.grid(row=9,column=2,sticky='w')
  cb['values']=('left','right','bottom','top')
  ttk.Label(frame3,text='Colorbar Padding').grid(row=10,column=1,sticky='w')
  tk.Entry(frame3,textvariable=PLOT.COLORBAR_PAD,width=7).grid(row=10,column=2,sticky='w')
  ttk.Label(frame3,text='Colorbar Size').grid(row=11,column=1,sticky='w')
  tk.Entry(frame3,textvariable=PLOT.COLORBAR_SIZE,width=7).grid(row=11,column=2,sticky='w')
  ttk.Label(frame3,text='Label Size').grid(row=12,column=1,sticky='w')
  tk.Entry(frame3,textvariable=PLOT.COLORBAR_LABELSIZE,width=7).grid(row=12,column=2,sticky='w')
  ttk.Label(frame3,text='Tick Size').grid(row=13,column=1,sticky='w')
  tk.Entry(frame3,textvariable=PLOT.COLORBAR_TICKSIZE,width=7).grid(row=13,column=2,sticky='w')
  frame3.grid()
Exemplo n.º 6
0
def Configuration(parent, PLOT):
    # ========================================
    ''' Interactive widget to modify the options of Dot plots'''

    __version__ = "1.0"
    __author__ = "Quim Ballabrerera"
    __date__ = "May 2018"

    # Main widget
    # ===========

    # Symbol list using standard and utf technical symbols
    #
    SYMBOL_LIST = ['.',',','o','v','^','<','>', \
                  '1','2','3','4','s','p','*',  \
                  'h','H','+','x','D','d','|','_']
    STYLE_LIST = ['-', '--', ':', '-.', '']
    for n in range(ord('\u2600'), ord('\u26B8') + 1):
        SYMBOL_LIST.append(chr(n))

    font = tkfont.Font(font='TkDefaultFont').copy()
    font_bold = tkfont.Font(font='TkDefaultFont').copy()
    font_bold['weight'] = 'bold'
    sdlabel = ttk.Style()
    sdlabel.configure("sdlabel.TLabel",
                      background=PLOT.COLOR.get(),
                      anchor="center")
    selabel = ttk.Style()
    selabel.configure("selabel.TLabel",
                      background=PLOT.EDGECOLOR.get(),
                      anchor="center")
    sflabel = ttk.Style()
    sflabel.configure("sflabel.TLabel",
                      background=PLOT.FACECOLOR.get(),
                      anchor="center")

    F0 = ttk.Frame(parent, borderwidth=5, padding=5)
    tk.Checkbutton(F0,text='Show geometries',font=font, variable=PLOT.SHOW). \
              grid(row=0,column=0,columnspan=6,sticky='ew')

    ttk.Label(F0, text='Polygons', font=font).grid(row=1, column=0, sticky='w')

    tk.Label(F0,text='Filled polygons',font=font). \
              grid(row=2,column=0,padx=3,sticky='w')
    tk.Checkbutton(F0,text='',variable=PLOT.FILLED,font=font). \
              grid(row=2,column=1,padx=3,sticky='w')

    ttk.Label(F0, text='Edge Color').grid(row=3, padx=3, column=0, sticky='w')
    ELabel = ttk.Label(F0,
                       textvariable=PLOT.EDGECOLOR,
                       width=8,
                       style="selabel.TLabel")
    ELabel.grid(row=3, padx=3, column=1)
    ttk.Button(F0,text='Select',command=lambda:colsel(PLOT.EDGECOLOR, \
              selabel,ELabel,"selabel.TLabel",master=parent)).\
              grid(row=3,column=2,padx=3,sticky='ew')

    ttk.Label(F0, text='Face Color').grid(row=4, padx=3, column=0, sticky='w')
    FLabel = ttk.Label(F0,
                       textvariable=PLOT.FACECOLOR,
                       width=8,
                       style="sflabel.TLabel")
    FLabel.grid(row=4, column=1)
    ttk.Button(F0,text='Select',command=lambda:colsel(PLOT.FACECOLOR, \
              sflabel,FLabel,"sflabel.TLabel",master=parent)).\
              grid(row=4,column=2,padx=3,sticky='ew')

    ttk.Label(F0, text='Line Style').grid(row=5, column=0, padx=3, sticky='w')
    ttk.Combobox(F0,textvariable=PLOT.LINESTYLE, \
                 values=STYLE_LIST,width=8).grid(row=5,column=1,padx=3,sticky='w')
    ttk.Label(F0, text='Line Width').grid(row=6, column=0, padx=3, sticky='w')
    ttk.Entry(F0, textvariable=PLOT.LINEWIDTH, width=8).grid(row=6,
                                                             column=1,
                                                             sticky='w')

    ttk.Label(F0, text='Points', font=font).grid(row=1, column=3, sticky='w')
    ttk.Label(F0, text='Symbol').grid(row=2,
                                      column=3,
                                      padx=3,
                                      columnspan=1,
                                      sticky='w')
    ttk.Combobox(F0,textvariable=PLOT.SYMBOL, \
                 values=SYMBOL_LIST,width=8).grid(row=2,column=4,padx=3,sticky='w')
    ttk.Label(F0, text='Size').grid(row=3, column=3, padx=3, sticky='w')
    ttk.Entry(F0, textvariable=PLOT.SIZE, width=8).grid(row=3,
                                                        column=4,
                                                        sticky='w')
    ttk.Label(F0, text='Color').grid(row=4, column=3, padx=3, sticky='w')
    DLabel = ttk.Label(F0,
                       textvariable=PLOT.COLOR,
                       width=8,
                       style="sdlabel.TLabel")
    DLabel.grid(row=4, column=4, padx=3)
    ttk.Button(F0,text='Select',command=lambda:colsel(PLOT.COLOR, \
              sdlabel,DLabel,"sdlabel.TLabel",master=parent)).\
              grid(row=4,column=5,sticky='ew')

    fs0 = ttk.Frame(F0)
    ttk.Label(fs0, text='Alpha').grid(row=0, column=1, padx=3)
    ttk.Entry(fs0, textvariable=PLOT.ALPHA, width=8).grid(row=0,
                                                          column=2,
                                                          padx=3)

    ttk.Label(fs0, text='Zorder').grid(row=0, column=3, padx=3)
    ttk.Entry(fs0, textvariable=PLOT.ZORDER, width=8).grid(row=0,
                                                           column=4,
                                                           padx=3)
    fs0.grid(row=7, column=0, columnspan=6, sticky='we', pady=10)
    F0.grid()
Exemplo n.º 7
0
def TextConfigure(parent,MPLOT):
# ======================================
  '''Dialogs to get marker text properties'''

  __version__ = "1.0"
  __author__  = "Quim Ballabrerera"
  __date__    = "May 2018"

  VARIANT_LIST = ['normal',
                  'small-caps']
  STYLE_LIST   = ['normal',
                  'italic',
                  'oblique']
  WEIGHT_LIST = ['ultralight',
                 'light',
                 'normal',
                 'regular',
                 'book',
                 'medium',
                 'roman',
                 'semibold',
                 'demibold',
                 'demi',
                 'bold',
                 'heavy',
                 'extra bold',
                 'black']
  HA_LIST     = ['center',
                 'right',
                 'left']
  VA_LIST     = ['center',
                 'top',
                 'bottom',
                 'baseline']
  
  sfclabel = ttk.Style()
  sfclabel.configure("sfclabel.TLabel",background=MPLOT.TCOLOR.get(),anchor="center")

  f0 = ttk.Frame(parent,borderwidth=5,padding=5)
  ttk.Label(f0,
            text='Font size').grid(row=0,
                                   column=0,
                                   padx=3)
  ttk.Entry(f0,
            textvariable=MPLOT.TSIZE,
            width=10).grid(row=0,
                           column=1,
                           padx=3,
                           sticky='w')
  ttk.Label(f0,
            text='Font style').grid(row=1,
                                   column=0,
                                   padx=3)
  ttk.Combobox(f0,
            textvariable=MPLOT.STYLE,
            values=STYLE_LIST,
            width=10).grid(row=1,
                           column=1,
                           padx=3,
                           sticky='w')
                           
  ttk.Label(f0,text='Font color').grid(row=2,column=0,padx=3)
  FCLabel = ttk.Label(f0,textvariable=MPLOT.TCOLOR,width=10,style="sfclabel.TLabel")
  FCLabel.grid(row=2,column=1)
  ttk.Button(f0,text='Select',command=lambda:colsel(MPLOT.TCOLOR, \
            sfclabel,FCLabel,"sfclabel.TLabel",master=parent)).grid(row=2,column=2)
                                  
  ttk.Label(f0,
            text='Font weight').grid(row=3,
                                   column=0,
                                   padx=3)
  ttk.Combobox(f0,
            textvariable=MPLOT.WEIGHT,
            values=WEIGHT_LIST,
            width=10).grid(row=3,
                           column=1,
                           padx=3,
                           sticky='w')
  ttk.Label(f0,
            text='Horizontal alignment').grid(row=4,
                                   column=0,
                                   padx=3)
  ttk.Combobox(f0,
            textvariable=MPLOT.HA,
            values=HA_LIST,
            width=10).grid(row=4,
                           column=1,
                           padx=3,
                           sticky='w')
  ttk.Label(f0,
            text='Vertical alignment').grid(row=5,
                                   column=0,
                                   padx=3)
  ttk.Combobox(f0,
            textvariable=MPLOT.VA,
            values=VA_LIST,
            width=10).grid(row=5,
                           column=1,
                           padx=3,
                           sticky='w')
  ttk.Label(f0,
            text='Text wrap').grid(row=6,
                                   column=0,
                                   padx=3)
  ttk.Combobox(f0,
            textvariable=MPLOT.WRAP,
            values=[True,False],
            width=10).grid(row=6,
                           column=1,
                           padx=3,
                           sticky='w')
  ttk.Label(f0,
            text='Text angle').grid(row=7,
                                   column=0,
                                   padx=3)
  ttk.Entry(f0,
            textvariable=MPLOT.ANGLE,
            width=10).grid(row=7,
                           column=1,
                           padx=3,
                           sticky='w')
  ttk.Label(f0,
            text='x pad').grid(row=8,
                                   column=0,
                                   padx=3)
  ttk.Entry(f0,
            textvariable=MPLOT.XPAD,
            width=10).grid(row=8,
                           column=1,
                           padx=3,
                           sticky='w')
  ttk.Label(f0,
            text='y pad').grid(row=9,
                                   column=0,
                                   padx=3)
  ttk.Entry(f0,
            textvariable=MPLOT.YPAD,
            width=10).grid(row=9,
                           column=1,
                           padx=3,
                           sticky='w')
  ttk.Label(f0,
            text='Zorder').grid(row=10,
                                   column=0,
                                   padx=3)
  ttk.Entry(f0,
            textvariable=MPLOT.ZORDER,
            width=10).grid(row=10,
                           column=1,
                           padx=3,
                           sticky='w')
  f0.grid()
Exemplo n.º 8
0
def Configuration2(parent, E):
    # =================================================================
    ''' Interactive widget to modify the options of 2D contour plots'''

    __version__ = "1.0"
    __author__ = "Quim Ballabrerera"
    __date__ = "August 2020"

    font_bold = tkfont.Font(font='TkDefaultFont').copy()
    font_bold['weight'] = 'bold'

    frame1 = ttk.Frame(parent, borderwidth=5, padding=5, relief='sunken')
    ttk.Label(frame1, text='Ellipse of variance',
              font=font_bold).grid(row=0, column=0, sticky='w')
    ttk.Label(frame1, text='ALIAS:').grid(row=1, column=0, sticky='w')
    ttk.Label(frame1, text=E.ALIAS.get(), width=30).grid(row=1,
                                                         column=1,
                                                         sticky='w')
    ttk.Label(frame1, text='SOURCE:').grid(row=2, column=0, sticky='w')
    ttk.Label(frame1, text=E.SOURCE, width=30).grid(row=2,
                                                    column=1,
                                                    sticky='w')
    ttk.Label(frame1, text='PARENT:').grid(row=3, column=0, sticky='w')
    ttk.Label(frame1, text=E.PARENT, width=30).grid(row=3,
                                                    column=1,
                                                    sticky='w')
    frame1.grid()

    frame2 = ttk.Frame(parent, borderwidth=5, padding=5)

    ttk.Label(frame2,
              text='Add mean and anomaly directions:').grid(row=0,
                                                            column=0,
                                                            columnspan=2,
                                                            sticky='we')
    tk.Checkbutton(frame2, variable=E.PLOT.ADD_ROTATION).grid(row=0,
                                                              column=2,
                                                              sticky='w')

    ttk.Label(frame2, text='Size scale:').grid(row=1, column=0, sticky='e')
    ttk.Entry(frame2, textvariable=E.PLOT.scale, width=10).grid(row=1,
                                                                column=1,
                                                                sticky='we')
    ttk.Label(frame2, text='Line style:').grid(row=2, column=0, sticky='e')
    ttk.Entry(frame2, textvariable=E.PLOT.LINE_STYLE,
              width=10).grid(row=2, column=1, sticky='we')
    ttk.Label(frame2, text='Line width:').grid(row=3, column=0, sticky='e')
    ttk.Entry(frame2, textvariable=E.PLOT.LINE_WIDTH,
              width=10).grid(row=3, column=1, sticky='we')

    ttk.Label(frame2, text='Line color:').grid(row=4, column=0, sticky='e')
    sclabel = ttk.Style()
    sclabel.configure("sclabel.TLabel",
                      background=E.PLOT.LINE_COLOR.get(),
                      anchor="center")
    ecol = ttk.Label(frame2,
                     textvariable=E.PLOT.LINE_COLOR,
                     width=8,
                     style="sclabel.TLabel")  # Map Contour Color
    ecol.grid(row=4, column=1, padx=3, sticky='we')
    ttk.Button(frame2,text='Select',command=lambda:colsel(E.PLOT.LINE_COLOR, \
              sclabel,ecol,"sclabel.TLabel",master=parent)).\
              grid(row=4,column=2,padx=3,sticky='ew')

    ttk.Label(frame2, text='Show center point:').grid(row=5,
                                                      column=0,
                                                      columnspan=2,
                                                      sticky='we')
    tk.Checkbutton(frame2, variable=E.PLOT.SHOW_CENTER).grid(row=5,
                                                             column=2,
                                                             sticky='w')
    ttk.Label(frame2, text='Show mean direction:').grid(row=6,
                                                        column=0,
                                                        columnspan=2,
                                                        sticky='we')
    tk.Checkbutton(frame2, variable=E.PLOT.SHOW_MAJOR).grid(row=6,
                                                            column=2,
                                                            sticky='w')
    ttk.Label(frame2, text='Alpha:').grid(row=7, column=0, sticky='e')
    ttk.Entry(frame2, textvariable=E.PLOT.ALPHA, width=10).grid(row=7,
                                                                column=1,
                                                                sticky='we')
    ttk.Label(frame2, text='Zorder:').grid(row=8, column=0, sticky='e')
    ttk.Entry(frame2, textvariable=E.PLOT.ZORDER, width=10).grid(row=8,
                                                                 column=1,
                                                                 sticky='we')
    frame2.grid()
Exemplo n.º 9
0
def Configuration(parent, E):
    # =================================================================
    ''' Interactive widget to modify the options of 2D contour plots'''

    __version__ = "1.0"
    __author__ = "Quim Ballabrerera"
    __date__ = "July 2020"

    frame2 = ttk.Frame(parent, borderwidth=5, padding=5)

    ttk.Label(frame2, text='Ellipse position, xo:').grid(row=0,
                                                         column=0,
                                                         sticky='e')
    ttk.Entry(frame2, textvariable=E.xo, width=10).grid(row=0,
                                                        column=1,
                                                        sticky='we')
    ttk.Label(frame2, text='yo:').grid(row=0, column=2, sticky='e')
    ttk.Entry(frame2, textvariable=E.yo, width=10).grid(row=0,
                                                        column=3,
                                                        sticky='we')

    ttk.Label(frame2, text='Semi-axis, major, a:').grid(row=1,
                                                        column=0,
                                                        sticky='e')
    ttk.Entry(frame2, textvariable=E.a, width=10).grid(row=1,
                                                       column=1,
                                                       sticky='we')
    ttk.Label(frame2, text='minor, b:').grid(row=1, column=2, sticky='e')
    ttk.Label(frame2, text='Orientation, phi:').grid(row=2,
                                                     column=0,
                                                     sticky='e')
    ttk.Entry(frame2, textvariable=E.phi, width=10).grid(row=2,
                                                         column=1,
                                                         sticky='we')
    ttk.Label(frame2, text='Scale factor:').grid(row=3, column=0, sticky='e')
    ttk.Entry(frame2, textvariable=E.scale, width=10).grid(row=3,
                                                           column=1,
                                                           sticky='we')

    ccol = ttk.Radiobutton(frame2,
                           text='Color',
                           variable=PLOT.CONTOUR_LINEMODE,
                           value='C')
    cmap = ttk.Radiobutton(frame2,
                           text='Colormap',
                           variable=PLOT.CONTOUR_LINEMODE,
                           value='M')
    ccol.grid(row=4, column=0, sticky='w')
    cmap.grid(row=5, column=0, sticky='w')

    sclabel = ttk.Style()
    sclabel.configure("sclabel.TLabel",
                      background=PLOT.CONTOUR_COLOR.get(),
                      anchor="center")
    ecol = ttk.Label(frame2,
                     textvariable=PLOT.CONTOUR_COLOR,
                     width=8,
                     style="sclabel.TLabel")  # Map Contour Color
    ecol.grid(row=4, column=1, padx=3, sticky='we')
    ttk.Button(frame2,text='Select',command=lambda:colsel(PLOT.CONTOUR_COLOR, \
              sclabel,ecol,"sclabel.TLabel",master=parent)).\
              grid(row=4,column=2,padx=3,sticky='ew')

    emap = ttk.Entry(frame2,
                     textvariable=PLOT.CONTOUR_COLORMAP,
                     justify='left',
                     width=7)  # Map Contour Color
    emap.grid(row=5, column=1, padx=3, sticky='we')
    ttk.Button(frame2, text='Select', command=mselection).grid(row=5,
                                                               column=2,
                                                               padx=3,
                                                               sticky='ew')
    tk.Checkbutton(frame2, text='Reverse',
                   variable=PLOT.CONTOUR_REVERSE).grid(row=5,
                                                       column=3,
                                                       sticky='w')

    ttk.Label(frame2, text='Alpha:').grid(row=6, column=0, sticky='w')
    ttk.Entry(frame2, textvariable=E.ALPHA, width=7).grid(row=6,
                                                          column=1,
                                                          sticky='w')
    ttk.Label(frame2, text='Zorder:').grid(row=7, column=0, sticky='w')
    ttk.Entry(frame2, textvariable=E.ZORDER, width=7).grid(row=7,
                                                           column=1,
                                                           sticky='w')
    #ttk.Label(frame2,text='0: transparent; 1: opaque').grid(row=6,column=2,sticky='w')
    frame2.grid()
Exemplo n.º 10
0
def Configuration_OnMap(parent, PLOT, LL):
    # ========================================
    ''' Interactive widget to modify the options of 2D line plots'''

    __version__ = "1.1"
    __author__ = "Quim Ballabrerera"
    __date__ = "January 2018"

    sfline, ssmarker = ttk.Style(), ttk.Style()
    global LLabel

    def iselection():
        global Llabel
        '''Select floater'''
        #cbox['text'] = LL.FLOAT_COLOR[LL.I.get()]
        LLabel['textvariable'] = LL.FLOAT_COLOR[LL.I.get()]
        _ifshow['variable'] = LL.FLOAT_SHOW[LL.I.get()]
        _ifzord['textvariable'] = LL.FLOAT_ZORDER[LL.I.get()]
        sfline.configure("sfline.TLabel",
                         background=LL.FLOAT_COLOR[LL.I.get()].get(),
                         anchor="center")
        #LLabel.configure(style="sfline.Tlabel")

    def cselection():
        '''Select floater'''
        #print(cbox.get())
        LL.FLOAT_COLOR[LL.I.get()].set(cbox.get())
        LLabel['textvariable'] = LL.FLOAT_COLOR[LL.I.get()]

    def default_color():
        for i in range(LL.nfloats):
            LL.FLOAT_COLOR[i].set(LL.PLOT.LINE_COLOR.get())

    '''def line_color():
    if LL.FLOAT_COLOR[LL.I.get()].get() == 'None':
      rgb, hx = askcolor(parent=parent)
    else:
      backup = LL.FLOAT_COLOR[LL.I.get()].get()
      rgb, hx = askcolor(color=LL.FLOAT_COLOR[LL.I.get()].get(),parent=parent)
      if hx is None:
        LL.FLOAT_COLOR[LL.I.get()].set(backup)
      else:
        LL.FLOAT_COLOR[LL.I.get()].set(hx)'''
    '''def marker_color():
    if PLOT.ONMAP_COLOR.get() == 'None':
      rgb, hx = askcolor(parent=parent)
    else:
      rgb, hx = askcolor(color=PLOT.ONMAP_COLOR.get(),parent=parent)
    PLOT.ONMAP_COLOR.set(hx)'''

    # Main widget
    # ===========
    MARKER_STYLE_LIST = [
        '.', ',', 'o', 'v', '^', '<', '>', '1', '2', '3', '4', 's', 'p', '*',
        'h', 'H', '+', 'x', 'D', 'd', '|', '_'
    ]

    # Styles
    font_bold = tkfont.Font(font='TkDefaultFont').copy()
    font_bold['weight'] = 'bold'

    ssmarker.configure("ssmarker.TLabel",
                       background=PLOT.ONMAP_COLOR.get(),
                       anchor="center")
    sfline.configure("sfline.TLabel",
                     background=LL.FLOAT_COLOR[LL.I.get()].get(),
                     anchor="center")

    fcbold = ttk.Style()
    fcbold.configure("fcbold.TCheckbutton", font=font_bold)

    F0 = tk.LabelFrame(parent,
                       text='Trajectory interpolation',
                       borderwidth=5,
                       font=font_bold)
    ttk.Checkbutton(F0,text='Show interpolated',variable=PLOT.ONMAP_SHOW, \
              style="fcbold.TCheckbutton").grid(row=0,column=0,columnspan=2,pady=10,sticky='e')
    ttk.Label(F0, text='Marker Style').grid(row=1, column=0, sticky='w')
    ttk.Combobox(F0,textvariable=PLOT.ONMAP_STYLE,values=MARKER_STYLE_LIST,\
              width=8,justify="center").grid(row=1,column=1,sticky='w')
    ttk.Label(F0, text='Marker Size').grid(row=2, column=0, sticky='w')
    ttk.Entry(F0, textvariable=PLOT.ONMAP_SIZE, width=8,
              justify="center").grid(row=2, column=1, sticky='w')
    ttk.Label(F0, text='Marker Color').grid(row=3, column=0, sticky='w')
    MMLabel = ttk.Label(F0,
                        textvariable=PLOT.ONMAP_COLOR,
                        width=8,
                        style="ssmarker.TLabel")
    MMLabel.grid(row=3, column=1, sticky='w')
    ttk.Button(F0,text='Select',command=lambda:colsel(PLOT.ONMAP_COLOR, \
              ssmarker,MMLabel,"ssmarker.TLabel",master=parent)). \
              grid(row=3,column=2,sticky='w')
    F0.grid(row=0, column=0, padx=20, pady=10, ipadx=20, ipady=10, sticky='w')

    F1 = ttk.Frame(parent, borderwidth=5)
    ttk.Label(F1,text='Trajectory limits',font=font_bold).\
              grid(row=0,column=0,columnspan=2,sticky='ew')
    ttk.Label(F1, text='Initial record').grid(row=1, column=0, sticky='w')
    ttk.Entry(F1, textvariable=LL.L1, width=8).grid(row=1,
                                                    column=1,
                                                    sticky='w')
    ttk.Label(F1, text='Last record').grid(row=2,
                                           column=0,
                                           columnspan=1,
                                           sticky='w')
    ttk.Entry(F1, textvariable=LL.L2, justify='left', width=8).grid(row=2,
                                                                    column=1,
                                                                    sticky='w')
    F1.grid(row=1, column=0, padx=20, pady=10, ipadx=20, ipady=10, sticky='ew')

    F2 = tk.LabelFrame(parent,
                       text='Individual Float options',
                       borderwidth=5,
                       font=font_bold)
    ttk.Checkbutton(F2,text='Use individual options',variable=LL.SEPARATED_COLOR, \
              style="fcbold.TCheckbutton").grid(row=0,column=1,columnspan=2)

    ttk.Label(F2, text='Floater:').grid(row=1, column=0, padx=3)
    ibox = ttk.Combobox(F2, textvariable=LL.I, width=5)
    ibox.grid(row=1, column=1, sticky='w')
    ibox.bind('<<ComboboxSelected>>', lambda e: iselection())
    ibox['values'] = list(range(LL.nfloats))

    _ifshow = ttk.Checkbutton(F2,
                              text='Show',
                              variable=LL.FLOAT_SHOW[LL.I.get()])
    _ifshow.grid(row=1, column=2, padx=3, sticky='we')

    ttk.Label(F2, text='Zorder').grid(row=1, column=3, padx=10, sticky='w')
    _ifzord = ttk.Entry(F2,
                        textvariable=LL.FLOAT_ZORDER[LL.I.get()],
                        justify='left',
                        width=8)
    _ifzord.grid(row=1, column=4, sticky='w')

    ttk.Label(F2, text='Color').grid(row=1, column=5, padx=10, sticky='w')
    LLabel = ttk.Label(F2,
                       textvariable=LL.FLOAT_COLOR[LL.I.get()],
                       width=8,
                       style="sfline.TLabel")
    LLabel.grid(row=1, column=6, sticky='w')
    LLabel.bind('<Return>', lambda e: cselection())
    ttk.Button(F2,text='Select',command=lambda:colsel(LL.FLOAT_COLOR[LL.I.get()], \
              sfline,LLabel,"sfline.TLabel",master=parent)). \
              grid(row=1,column=7,sticky='w')
    ''' OJO NO SE SI ESCORRECTO
  cbox = ttk.Entry(F2,textvariable=LL.FLOAT_COLOR[LL.I.get()],justify='left',width=10)
  cbox.grid(row=1,column=3,sticky='w')
  cbox.bind('<Return>',lambda e: cselection())
  '''
    # AAA
    #ttk.Button(F2,text='Select',command=line_color).grid(row=1,column=4,padx=3,sticky='ew')
    ttk.Button(F2, text='Default', command=default_color).grid(row=1,
                                                               column=8,
                                                               padx=3,
                                                               sticky='w')
    F2.grid(row=2, column=0, padx=20, pady=10, ipadx=20, ipady=10, sticky='w')
Exemplo n.º 11
0
def Configuration(parent, PLOT):
    # ========================================
    ''' Interactive widget to modify the options of 2D line plots'''

    __version__ = "1.0"
    __author__ = "Quim Ballabrerera"
    __date__ = "December 2017"

    # Main widget
    # ===========
    LINE_STYLE_LIST = ['-', '--', '-.', ':']
    MARKER_STYLE_LIST = [
        '.', ',', 'o', 'v', '^', '<', '>', '1', '2', '3', '4', 's', 'p', '*',
        'h', 'H', '+', 'x', 'D', 'd', '|', '_'
    ]

    # Styles
    font_bold = tkfont.Font(font='TkDefaultFont').copy()
    font_bold['weight'] = 'bold'
    sline, smarker, sinicia = ttk.Style(), ttk.Style(), ttk.Style()
    sline.configure("sline.TLabel",
                    background=PLOT.LINE_COLOR.get(),
                    anchor="center")
    smarker.configure("smarker.TLabel",
                      background=PLOT.MARKER_COLOR.get(),
                      anchor="center")
    sinicia.configure("sinicia.TLabel",
                      background=PLOT.INITIAL_COLOR.get(),
                      anchor="center")
    fcbold = ttk.Style()
    fcbold.configure("fcbold.TCheckbutton", font=font_bold)

    F0 = tk.LabelFrame(parent,
                       text='Line options',
                       borderwidth=5,
                       font=font_bold)
    ttk.Checkbutton(F0,text='Line show',variable=PLOT.LINE_SHOW, \
              style="fcbold.TCheckbutton").grid(row=0,column=0,columnspan=2,pady=10,sticky='e')
    ttk.Label(F0, text='Line Style').grid(row=1, column=0, padx=10, sticky='w')
    ttk.Combobox(F0,textvariable=PLOT.LINE_STYLE,values=LINE_STYLE_LIST,\
              width=8,justify="center").grid(row=1,column=1,sticky='w')
    ttk.Label(F0, text='Line Width').grid(row=2, column=0, padx=10, sticky='w')
    ttk.Entry(F0, textvariable=PLOT.LINE_WIDTH, width=8,
              justify="center").grid(row=2, column=1, sticky='w')
    ttk.Label(F0, text='Line Color').grid(row=3, column=0, padx=10, sticky='w')
    LLabel = ttk.Label(F0,
                       textvariable=PLOT.LINE_COLOR,
                       width=8,
                       style="sline.TLabel")
    LLabel.grid(row=3, column=1, sticky='w')
    ttk.Button(F0,text='Select',command=lambda:colsel(PLOT.LINE_COLOR, \
              sline,LLabel,"sline.TLabel",master=parent)). \
              grid(row=3,column=2,sticky='w')
    F0.grid(row=0, column=0, padx=20, pady=10, ipadx=20, ipady=10)

    F3 = tk.LabelFrame(parent,
                       text='Other options',
                       borderwidth=5,
                       font=font_bold)
    ttk.Label(F3, text='Alpha').grid(row=0, column=0, padx=10, sticky='w')
    ttk.Entry(F3, textvariable=PLOT.ALPHA, width=8,
              justify="center").grid(row=0, column=1, sticky='w')
    ttk.Label(F3, text='Zorder').grid(row=1, column=0, padx=10, sticky='w')
    ttk.Entry(F3, textvariable=PLOT.ZORDER, width=8,
              justify="center").grid(row=1, column=1, sticky='w')
    F3.grid(row=0, column=1, padx=20, pady=10, ipadx=20, ipady=10)

    F1 = tk.LabelFrame(parent,
                       text='Marker options',
                       borderwidth=5,
                       font=font_bold)
    ttk.Checkbutton(F1,text='Marker show',variable=PLOT.MARKER_SHOW, \
              style="fcbold.TCheckbutton").grid(row=0,column=0,columnspan=2,pady=10,sticky='e')
    ttk.Label(F1, text='Marker Style').grid(row=1,
                                            column=0,
                                            padx=10,
                                            sticky='w')
    ttk.Combobox(F1,textvariable=PLOT.MARKER_STYLE,values=MARKER_STYLE_LIST,width=8, \
              justify="center").grid(row=1,column=1,sticky='w')
    ttk.Label(F1, text='Marker Size').grid(row=2,
                                           column=0,
                                           padx=10,
                                           sticky='w')
    ttk.Entry(F1, textvariable=PLOT.MARKER_SIZE, width=8,
              justify="center").grid(row=2, column=1, sticky='w')
    ttk.Label(F1, text='Marker Color').grid(row=3,
                                            column=0,
                                            padx=10,
                                            sticky='w')
    MLabel = ttk.Label(F1,
                       textvariable=PLOT.MARKER_COLOR,
                       width=8,
                       style="smarker.TLabel")
    MLabel.grid(row=3, column=1, sticky='w')
    ttk.Button(F1,text='Select',command=lambda:colsel(PLOT.MARKER_COLOR, \
              smarker,MLabel,"smarker.TLabel",master=parent)). \
              grid(row=3,column=2,sticky='w')
    F1.grid(row=1, column=0, padx=20, pady=10, ipadx=20, ipady=10)

    F2 = tk.LabelFrame(parent,
                       text='Initial Marker options',
                       borderwidth=5,
                       font=font_bold)
    ttk.Checkbutton(F2,text='Initial show',variable=PLOT.INITIAL_SHOW, \
              style="fcbold.TCheckbutton").grid(row=0,column=0,columnspan=2,pady=10,sticky='e')
    ttk.Label(F2, text='Initial Style').grid(row=1,
                                             column=0,
                                             padx=10,
                                             sticky='w')
    ttk.Combobox(F2,textvariable=PLOT.INITIAL_STYLE,values=MARKER_STYLE_LIST,\
              width=8,justify="center").grid(row=1,column=1,sticky='w')
    ttk.Label(F2, text='Initial Size').grid(row=2,
                                            column=0,
                                            padx=10,
                                            sticky='w')
    ttk.Entry(F2, textvariable=PLOT.INITIAL_SIZE, width=8,
              justify="center").grid(row=2, column=1, sticky='w')
    ttk.Label(F2, text='Initial Color').grid(row=3,
                                             column=0,
                                             padx=10,
                                             sticky='w')
    ILabel = ttk.Label(F2,
                       textvariable=PLOT.INITIAL_COLOR,
                       width=8,
                       style="sinicia.TLabel")
    ILabel.grid(row=3, column=1, sticky='w')
    ttk.Button(F2,text='Select',command=lambda:colsel(PLOT.INITIAL_COLOR, \
              sinicia,ILabel,"sinicia.TLabel",master=parent)). \
              grid(row=3,column=2,sticky='w')
    F2.grid(row=2, column=0, padx=20, pady=10, ipadx=20, ipady=10)