コード例 #1
0
ファイル: tixwidgets.py プロジェクト: Geniuspp/python
def MkCombo(w):
    options="label.width %d label.anchor %s entry.width %d" % (10, Tix.E, 14)

    static = Tix.ComboBox(w, label='Static', editable=0, options=options)
    editable = Tix.ComboBox(w, label='Editable', editable=1, options=options)
    history = Tix.ComboBox(w, label='History', editable=1, history=1,
                           anchor=Tix.E, options=options)
    static.insert(Tix.END, 'January')
    static.insert(Tix.END, 'February')
    static.insert(Tix.END, 'March')
    static.insert(Tix.END, 'April')
    static.insert(Tix.END, 'May')
    static.insert(Tix.END, 'June')
    static.insert(Tix.END, 'July')
    static.insert(Tix.END, 'August')
    static.insert(Tix.END, 'September')
    static.insert(Tix.END, 'October')
    static.insert(Tix.END, 'November')
    static.insert(Tix.END, 'December')

    editable.insert(Tix.END, 'Angola')
    editable.insert(Tix.END, 'Bangladesh')
    editable.insert(Tix.END, 'China')
    editable.insert(Tix.END, 'Denmark')
    editable.insert(Tix.END, 'Ecuador')

    history.insert(Tix.END, '/usr/bin/ksh')
    history.insert(Tix.END, '/usr/local/lib/python')
    history.insert(Tix.END, '/var/adm')

    static.pack(side=Tix.TOP, padx=5, pady=3)
    editable.pack(side=Tix.TOP, padx=5, pady=3)
    history.pack(side=Tix.TOP, padx=5, pady=3)
コード例 #2
0
 def ProbMonitorBoundary(self, w):
     self.point1_list = Tix.ComboBox(
         w,
         label="Point 1: ",
         dropdown=0,
         command=self.select_point1,
         editable=0,
         options=
         'listbox.height 1 label.padY 2 label.width 10 label.anchor ne')
     self.point1_list.pack(side=Tix.LEFT, anchor=Tix.W)
     self.point2_list = Tix.ComboBox(
         w,
         label="Point 2 : ",
         dropdown=0,
         command=self.select_point2,
         editable=0,
         options=
         'listbox.height 1 label.padY 2 label.width 10 label.anchor ne')
     self.point2_list.pack(side=Tix.LEFT, anchor=Tix.W)
     self.bound_type_list = Tix.ComboBox(
         w,
         label="Boundary Type : ",
         dropdown=0,
         command=self.select_bound_type,
         editable=0,
         options=
         'listbox.height 1 label.padY 2 label.width 15 label.anchor ne')
     self.bound_type_list.pack(side=Tix.LEFT, anchor=Tix.W)
コード例 #3
0
    def open_conf_dialog(self,num_cell='0',direction='vertical',type='num',cellwidth='0',cellheight='0',space='0'):
        """
        Abre o diálogo de configuração do campo selecionado
        @param num_cell string : quantidade de células do campo
        @param direction string: direção do campo (vertical ou horizontal)
        @param type string: tipo do campo (num ou char)
        @param cellwidth string: largura da célula do campo em pixels
        @param cellheight string: altura da célula do campo em pixels
        @param space string: espaçamento entre células em pixels
        """
        self.top=Toplevel(self.root)
        self.top.title('Configurar campo')
            
        self.top.protocol("WM_DELETE_WINDOW", self.cancel_field)
        

        self.imidbox= Checkbutton(self.top,text="Identificador",variable=self.imidvar)
        self.imidbox.pack()

        Label(self.top,text='Número de células:').pack()
        self.listnumber= Entry(self.top)
        self.listnumber.insert(0,num_cell)
        self.listnumber.pack()

        Label(self.top,text='Direção:').pack()
        self.listdirection=  Tix.ComboBox(self.top,selectmode=SINGLE)
        self.listdirection.pack()
        self.listdirection.insert(END,'vertical')
        self.listdirection.insert(END,'horizontal')
        self.listdirection['value']=direction

        Label(self.top,text='Tipo:').pack()
        self.listtype= Tix.ComboBox(self.top,selectmode=SINGLE)
        self.listtype.pack()
        self.listtype.insert(END,'char')
        self.listtype.insert(END,'num')
        self.listtype['value']=type

        Label(self.top,text='Largura da célula (px):').pack()
        self.cellwidth=Entry(self.top)
        self.cellwidth.pack()
        self.cellwidth.insert(0,cellwidth)        

        Label(self.top,text='Altura da célula (px):').pack()
        self.cellheight=Entry(self.top)
        self.cellheight.pack()
        self.cellheight.insert(0,cellheight)

        Label(self.top,text='Espaçamento (px):').pack()
        self.space=Entry(self.top)
        self.space.pack()
        self.space.insert(0,space)

        Button(self.top,text="OK",command=self.save_field).pack()
        if num_cell==0:
            Button(self.top,text="Cancelar",command=self.cancel_field).pack()
        else:
            Button(self.top,text="Cancelar",command=self.top.destroy).pack()
コード例 #4
0
 def body( self, master ):
    theRow = 0
    
    Tix.Label( master, text="Font Family" ).grid( row=theRow, column=0 )
    Tix.Label( master, text="Font Size" ).grid( row=theRow, column=2 )
    
    theRow += 1
    
    # Font Families
    fontList = Tix.ComboBox( master, command=self.selectionChanged, dropdown=False, editable=False, selectmode=Tix.IMMEDIATE, variable=self._family )
    fontList.grid( row=theRow, column=0, columnspan=2, sticky=Tix.N+Tix.S+Tix.E+Tix.W, padx=10 )
    first = None
    familyList = list(tkFont.families( ))
    familyList.sort()
    for family in familyList:
       if family[0] == '@':
          continue
       if first is None:
          first = family
       fontList.insert( Tix.END, family )
    fontList.configure( value=first )
    
    # Font Sizes
    sizeList = Tix.ComboBox( master, command=self.selectionChanged, dropdown=False, editable=False, selectmode=Tix.IMMEDIATE, variable=self._sizeString )
    sizeList.grid( row=theRow, column=2, columnspan=2, sticky=Tix.N+Tix.S+Tix.E+Tix.W, padx=10 )
    for size in xrange( 6,31 ):
       sizeList.insert( Tix.END, '%d' % size )
    sizeList.configure( value='9' )
    
    # Styles
    if self._showStyles is not None:
       theRow += 1
       
       if self._showStyles in ( FontChooser.ALL, FontChooser.BASIC ):
          Tix.Label( master, text='Styles', anchor=Tix.W ).grid( row=theRow, column=0, pady=10, sticky=Tix.W )
          
          theRow += 1
          
          Tix.Checkbutton( master, text="bold", command=self.selectionChanged, offvalue='normal', onvalue='bold', variable=self._weight ).grid(row=theRow, column=0)
          Tix.Checkbutton( master, text="italic", command=self.selectionChanged, offvalue='roman', onvalue='italic', variable=self._slant ).grid(row=theRow, column=1)
       
       if self._showStyles == FontChooser.ALL:
          Tix.Checkbutton( master, text="underline", command=self.selectionChanged, offvalue=False, onvalue=True, variable=self._isUnderline ).grid(row=theRow, column=2)
          Tix.Checkbutton( master, text="overstrike", command=self.selectionChanged, offvalue=False, onvalue=True, variable=self._isOverstrike ).grid(row=theRow, column=3)
    
    # Sample Text
    theRow += 1
    
    Tix.Label( master, text='Sample Text', anchor=Tix.W ).grid( row=theRow, column=0, pady=10, sticky=Tix.W )
    
    theRow += 1
    
    self.sampleText = Tix.Text( master, height=11, width=70 )
    self.sampleText.insert( Tix.INSERT,
                            'ABCDEFGHIJKLMNOPQRSTUVWXYZ\nabcdefghijklmnopqrstuvwxyz', 'fontStyle' )
    self.sampleText.config( state=Tix.DISABLED )
    self.sampleText.tag_config( 'fontStyle', font=self._currentFont )
    self.sampleText.grid( row=theRow, column=0, columnspan=4, padx=10 )
コード例 #5
0
    def ProbMonitorDiffEqu(self, w):
        user_prob = Tix.StringVar()
        self.prob_list = Tix.ComboBox(
            w,
            label="Problem: ",
            dropdown=0,
            command=self.select_problem,
            editable=0,
            variable=user_prob,
            options=
            'listbox.height 3 label.padY 2 label.width 8 label.anchor ne')
        self.prob_list.pack(side=Tix.TOP, anchor=Tix.W)
        self.diff_list = Tix.ComboBox(
            w,
            label="DEs: ",
            dropdown=0,
            command=self.select_diff,
            editable=0,
            options=
            'listbox.height 3 label.padY 2 label.width 4 label.anchor ne')
        self.diff_list.pack(side=Tix.TOP, anchor=Tix.W)
        self.source_list = Tix.ComboBox(
            w,
            label="Source Functions: ",
            dropdown=0,
            command=self.select_source,
            editable=0,
            options=
            'listbox.height 3 label.padY 2 label.width 13 label.anchor ne')
        self.solution_list = Tix.ComboBox(
            w,
            label="Solutions: ",
            dropdown=0,
            command=self.select_solution,
            editable=0,
            options=
            'listbox.height 3 label.padY 2 label.width 10 label.anchor ne')

        self.view_mode_option = Tix.Select(w,
                                           label='View mode:',
                                           allowzero=1,
                                           radio=1,
                                           orientation=Tix.VERTICAL)
        self.view_mode_option.add(
            'boundary', text='Boundary')  #command=self.setSolAssign())
        self.view_mode_option.add('source', text='Source Function')
        self.view_mode_option.add('solution', text='Solution')
        self.view_mode_option.subwidget_list['source'].invoke()
        self.view_mode_opt = self.view_mode_option["value"]

        self.source_list.pack(side=Tix.LEFT, anchor=Tix.W)
        self.prob_list.pack(side=Tix.LEFT, padx=5, pady=3, fill=Tix.X)
        self.diff_list.pack(side=Tix.LEFT, padx=5, pady=3, fill=Tix.X)
        self.solution_list.pack(side=Tix.LEFT, padx=5, pady=3, fill=Tix.X)
        self.view_mode_option.pack(side=Tix.LEFT, padx=5, pady=3, fill=Tix.X)
コード例 #6
0
ファイル: process.py プロジェクト: dianaagl/kumir1
    def createWidgets(self):
        self.LBL_LANGUAGE = Tix.Label(master=self, text=u'Целевой язык')
        self.LBL_LANGUAGE.grid(column=0, row=0)
        self.LANGUAGE_CHOOSER = Tix.ComboBox(master=self)
        self.LANGUAGE_CHOOSER.grid(row=0, column=1, columnspan=2, sticky='ew')
        self.LANGUAGE_MATCH = list()
        self.LANGUAGE_MATCH.append(('c99', 'C (ISO/IEC 9899:1999)'))
        self.LANGUAGE_MATCH.append(('c_plus_plus', 'C++ (ISO/IEC 14882:1998)'))
        self.LANGUAGE_CHOOSER.insert(0, 'C (ISO/IEC 9899:1999)')
        self.LANGUAGE_CHOOSER.insert(1, 'C++ (ISO/IEC 14882:1998)')
        self.LBL_ENCODING = Tix.Label(master=self, text=u'Кодировка файлов')
        self.LBL_ENCODING.grid(column=0, row=1)
        self.ENCODING_CHOOSER = Tix.ComboBox(master=self)
        self.ENCODING_CHOOSER.insert(0, u'cp866 (Windows OEM)')
        self.ENCODING_CHOOSER.insert(1, u'cp1251 (Windows ANSI)')
        self.ENCODING_CHOOSER.insert(2, u'koi8-r (FreeBSD)')
        self.ENCODING_CHOOSER.insert(3, u'utf-8 (Linux)')
        self.ENCODING_CHOOSER.grid(column=1, columnspan=2, sticky='ew', row=1)
        if os.name == "nt":
            self.ENCODING_CHOOSER['value'] = u'cp866 (Windows OEM)'
        else:
            self.ENCODING_CHOOSER['value'] = u'utf-8 (Linux)'
        self.LBL_TARGET_DIR = Tix.Label(master=self, text=u'Целевой каталог')
        self.LBL_TARGET_DIR.grid(column=0, row=2)
        self.TARGET_DIR = Tix.Entry(master=self)
        self.TARGET_DIR.grid(column=1, row=2)

        self.BTN_BROWSE = Tix.Button(master=self,
                                     text=u'...',
                                     command=self.browerTargetDir)
        self.BTN_BROWSE.grid(column=2, row=2)

        self.STATUS = Tix.Label(master=self, text='', fg='red')
        self.STATUS.grid(row=3, columnspan=3, sticky='ew')

        self.BOX = Tix.ButtonBox(master=self)
        self.BOX.grid(row=4, columnspan=3, sticky='ew')

        self.BTN_GO = Tix.Button(master=self.BOX,
                                 text=u'Конвертировать',
                                 bg="green",
                                 command=self.convert)
        self.BTN_GO.grid(column=0, row=0, sticky='ew')

        self.BTN_CLOSE = Tix.Button(master=self.BOX,
                                    text=u'Закрыть',
                                    bg="red",
                                    command=self.quit)
        self.BTN_CLOSE.grid(column=1, row=0, sticky='ew')
コード例 #7
0
 def ProbDiffEqu(self, w):
     #user_fn = Tix.StringVar()
     self.diff_e = Tix.ComboBox(
         w,
         label="Differential Equation List: ",
         dropdown=0,
         command=lambda w=w: self.select_DE(w),
         editable=1,
         variable=self.DE,
         options=
         'listbox.height 5 label.padY 5 label.width 25 label.anchor ne')
     self.diff_e.pack(side=Tix.TOP, anchor=Tix.W)
     self.diff_e.insert(Tix.END, 'F[0][0]')
     self.diff_e.insert(Tix.END, 'F[1][0]')
     self.diff_e.insert(Tix.END, 'F[0][1]')
     self.diff_e.insert(Tix.END, 'F[2][0]')
     self.diff_e.insert(Tix.END, 'F[0][2]')
     self.diff_e.insert(Tix.END, 'F[1][1]')
     self.diff_e.insert(Tix.END, 'F[2][1]')
     self.diff_e.insert(Tix.END, 'F[1][2]')
     self.diff_e.insert(Tix.END, 'F[3][0]')
     self.diff_e.insert(Tix.END, 'F[0][3]')
     self.diff_e.insert(Tix.END, 'F[2][0]+F[0][2]')
     self.diff_e.set_silent('F[0][0]')
     self.diff_e.pack(fill=Tix.X, padx=5, pady=3)
コード例 #8
0
ファイル: SensorGUI.py プロジェクト: l4es/EmbeddedPlatforms
    def __init__(self, parent, *args, **kwargs):
        Tkinter.Frame.__init__(self, parent, *args, **kwargs)
        self.title = Tkinter.Label(master=self, text="muse231")
        self.title.pack(side=Tkinter.TOP)

        #self.img=Tkinter.PhotoImage(file="pictures/muse231.gif")
        #Tkinter.Label(master=self, image=self.img).pack(side=Tkinter.LEFT)

        self.valframe = Tkinter.Frame(master=self,
                                      relief=Tkinter.RAISED,
                                      borderwidth=1)
        self.valframe.pack(side=Tkinter.TOP)
        Tkinter.Label(master=self.valframe,
                      text="Measurement Data").pack(side=Tkinter.TOP)

        self.sht_t = Tkinter.DoubleVar(value=25.0)
        ValField(master=self.valframe,
                 name="SHT T",
                 unit="degC",
                 val=self.sht_t).pack(side=Tkinter.BOTTOM)

        self.sht_rh = Tkinter.DoubleVar(value=0.5)
        ValField(master=self.valframe,
                 name="SHT RH",
                 unit="vH",
                 val=self.sht_rh).pack(side=Tkinter.BOTTOM)

        self.vmcu = Tkinter.DoubleVar(value=2.85)
        ValField(master=self.valframe, name="VMCU", unit="mV",
                 val=self.vmcu).pack(side=Tkinter.BOTTOM)

        self.cfgframe = Tkinter.Frame(master=self,
                                      relief=Tkinter.RAISED,
                                      borderwidth=1)
        self.cfgframe.pack(side=Tkinter.TOP)
        Tkinter.Label(master=self.cfgframe,
                      text="Configuration").pack(side=Tkinter.TOP)

        self.cfg_accenable = Tkinter.BooleanVar()
        Tkinter.Checkbutton(master=self.cfgframe,
                            text="ACC enable",
                            variable=self.cfg_accenable).pack(side=Tkinter.TOP)
        self.cfg_shtenable = Tkinter.BooleanVar()
        Tkinter.Checkbutton(master=self.cfgframe,
                            text="SHT21 enable",
                            variable=self.cfg_shtenable).pack(side=Tkinter.TOP)
        self.cfg_blink = Tkinter.BooleanVar()
        Tkinter.Checkbutton(master=self.cfgframe,
                            text="Blink on sample",
                            variable=self.cfg_blink).pack(side=Tkinter.TOP)

        rates = [0.1, 1.0, 8.0, 60.0]
        self.cfg_samplerate = Tkinter.DoubleVar()
        Tkinter.Label(master=self.cfgframe,
                      text='Sample Rate [Hz]').pack(side=Tkinter.TOP)
        cb = Tix.ComboBox(master=self.cfgframe, variable=self.cfg_samplerate)
        cb.pack(side=Tkinter.TOP)
        bal = Tix.Balloon(self.cfgframe)
        bal.bind_widget(cb, balloonmsg="Sample rate of measurement")
        [cb.insert(Tix.END, '%.2f' % (1 / i)) for i in rates]
コード例 #9
0
ファイル: pman.py プロジェクト: Fyedka/mage
 def __init__(self, master=None):
     self.mandirs = ManDirectories()
     self.frame = Tix.Frame(master)
     self.section = Tix.StringVar()
     combo = Tix.ComboBox(self.frame,
                          label='Section: ',
                          dropdown=1,
                          editable=0,
                          variable=self.section,
                          command=self.UpdatePageList)
     pagelist = Tix.ScrolledListBox(self.frame, scrollbar='auto')
     self.listbox = pagelist.listbox
     self.listbox.bind('<Double-1>', self.ShowPage)
     temp = self.mandirs.section_names.keys()
     temp.sort()
     for s in temp:
         combo.insert(Tix.END, s)
     box = Tix.ButtonBox(self.frame, orientation=Tix.HORIZONTAL)
     box.add('show',
             text='Show Page ...',
             underline=0,
             width=13,
             command=self.ShowPage)
     box.add('aprop',
             text='Apropos ...',
             underline=0,
             width=13,
             command=self.Apropos)
     box.add('quit', text='Quit', underline=0, width=13, command=self.Quit)
     combo.pack(side=Tix.TOP, expand=0, fill=Tix.X)
     pagelist.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH)
     box.pack(side=Tix.BOTTOM, expand=0, fill=Tix.X)
     self.frame.pack(expand=1, fill=Tix.BOTH)
コード例 #10
0
    def SolutionRepresentationMonitor(self, w):
        self.rep_list = Tix.ComboBox(
            w,
            label="Representation: ",
            dropdown=0,
            command=self.select_representation,
            editable=0,
            options=
            'listbox.height 3 label.padY 2 label.width 15 label.anchor ne')
        self.rep_list.pack(side=Tix.TOP, anchor=Tix.W)
        self.rep_info_list = Tix.ComboBox(
            w,
            label="Representation info: ",
            dropdown=0,
            command=self.select_rep_info_list,
            editable=0,
            options=
            'listbox.height 3 label.padY 2 label.width 15 label.anchor ne')
        self.rep_problem_list = Tix.ComboBox(
            w,
            label="Problem List: ",
            dropdown=0,
            command=self.select_rep_prob_list,
            editable=0,
            options=
            'listbox.height 3 label.padY 2 label.width 10 label.anchor ne')
        self.rep_problem_info_list = Tix.ComboBox(
            w,
            label="Problem info list: ",
            dropdown=0,
            command=self.select_rep_problem_info_list,
            editable=0,
            options=
            'listbox.height 3 label.padY 2 label.width 15 label.anchor ne')

        self.rep_list.pack(side=Tix.LEFT, anchor=Tix.W)
        self.rep_info_list.pack(side=Tix.LEFT, padx=5, pady=3, fill=Tix.X)
        self.rep_problem_list.pack(side=Tix.LEFT, padx=5, pady=3, fill=Tix.X)
        self.rep_problem_info_list.pack(side=Tix.LEFT,
                                        padx=5,
                                        pady=3,
                                        fill=Tix.X)
コード例 #11
0
    def __build__(self,root,row):
        ''' Build a combobox

            @type  root: C{Tix.Tk}
            @param root: Root Tk instance.
            @type  row:  C{int}
            @param row:  Grid row to place the file browser in.
        '''
        self.TkPhotoImage = Tix.PhotoImage(format=self.icon.format,data=self.icon.data) # keep a reference! See http://effbot.org/tkinterbook/photoimage.htm
        if self.multiselect:
            self._value = Tix.StringVar(root)
            self.dummy = Tix.StringVar(root)
            self.TkComboBox=Tix.ComboBox(root, dropdown=1, command=self.__updatemulti__,selectmode='immediate',editable=1,variable=self.dummy,options='listbox.height 6 listbox.background white')
            self.TkComboBox.subwidget('slistbox').subwidget('listbox').configure(selectmode='extended')
        else:
            self._value = Tix.StringVar(root)
            self.TkComboBox=Tix.ComboBox(root, command=self.callback, dropdown=1, editable=1,variable=self._value,options='listbox.height 6 listbox.background white')

        self.TkLabel=Tix.Label(root, text=self.label+':')
        for o in self.options:self.TkComboBox.insert(Tix.END, o)
        if self.opt.default is not None:
            selected=self.opt.default
        else:
            selected=self.options[0]

        self.TkComboBox.set_silent(selected)
        self._value.set(selected)

        self.TkComboBox.subwidget('entry').bind('<Key>', lambda e: 'break')
        self.TkImage = Tix.Label(root,image=self.TkPhotoImage)
        self.TkLabel.grid(row=row, column=0,sticky=Tix.W, padx=2)
        self.TkComboBox.grid(row=row, column=1,sticky=Tix.E+Tix.W)
        self.TkImage.grid(row=row, column=2,sticky=Tix.E, padx=2)
        if self.tooltip:
            self.TkLabelToolTip=_ToolTip(self.TkLabel, delay=250, follow_mouse=1, text=self.tooltip)
            self.TkDropListToolTip=_ToolTip(self.TkComboBox, delay=250, follow_mouse=1, text=self.tooltip)
            self.TkImageToolTip=_ToolTip(self.TkImage, delay=250, follow_mouse=1, text=self.tooltip)

        #self._value.trace('w',self.callback)

        self.enabled=self.enabled #Force update
コード例 #12
0
ファイル: TkEventMaker.py プロジェクト: drewp/eventually
    def __init__(self, master, name, contents):
        Tk.Frame.__init__(self, master)
        make_attributes_from_args('name', 'contents')

        self.button = Tk.Button(self, text=name)
        self.button.pack(side='left')
        self.combo = Tk.ComboBox(self)
        self.combo.pack(side='left')
        self.pack(side='left')

        self.listbox = self.combo.slistbox.listbox
        self.strings_to_parse = {}
コード例 #13
0
def MkCombo(w):
    prefix = Tix.OptionName(w)
    if not prefix: prefix = ''
    w.option_add('*' + prefix + '*TixComboBox*label.width', 10)
    w.option_add('*' + prefix + '*TixComboBox*label.anchor', Tix.E)
    w.option_add('*' + prefix + '*TixComboBox*entry.width', 14)

    static = Tix.ComboBox(w, label='Static', editable=0)
    editable = Tix.ComboBox(w, label='Editable', editable=1)
    history = Tix.ComboBox(w,
                           label='History',
                           editable=1,
                           history=1,
                           anchor=Tix.E)
    static.insert(Tix.END, 'January')
    static.insert(Tix.END, 'February')
    static.insert(Tix.END, 'March')
    static.insert(Tix.END, 'April')
    static.insert(Tix.END, 'May')
    static.insert(Tix.END, 'June')
    static.insert(Tix.END, 'July')
    static.insert(Tix.END, 'August')
    static.insert(Tix.END, 'September')
    static.insert(Tix.END, 'October')
    static.insert(Tix.END, 'November')
    static.insert(Tix.END, 'December')

    editable.insert(Tix.END, 'Angola')
    editable.insert(Tix.END, 'Bangladesh')
    editable.insert(Tix.END, 'China')
    editable.insert(Tix.END, 'Denmark')
    editable.insert(Tix.END, 'Ecuador')

    history.insert(Tix.END, '/usr/bin/ksh')
    history.insert(Tix.END, '/usr/local/lib/python')
    history.insert(Tix.END, '/var/adm')

    static.pack(side=Tix.TOP, padx=5, pady=3)
    editable.pack(side=Tix.TOP, padx=5, pady=3)
    history.pack(side=Tix.TOP, padx=5, pady=3)
コード例 #14
0
ファイル: tixwidgets.py プロジェクト: Oize/pspstacklesspython
def MkWelcomeBar(top):
    global demo

    w = Tix.Frame(top, bd=2, relief=Tix.GROOVE)
    b1 = Tix.ComboBox(w, command=lambda w=top: MainTextFont(w))
    b2 = Tix.ComboBox(w, command=lambda w=top: MainTextFont(w))
    b1.entry['width'] = 15
    b1.slistbox.listbox['height'] = 3
    b2.entry['width'] = 4
    b2.slistbox.listbox['height'] = 3

    demo.welfont = b1
    demo.welsize = b2

    b1.insert(Tix.END, 'Courier')
    b1.insert(Tix.END, 'Helvetica')
    b1.insert(Tix.END, 'Lucida')
    b1.insert(Tix.END, 'Times Roman')

    b2.insert(Tix.END, '8')
    b2.insert(Tix.END, '10')
    b2.insert(Tix.END, '12')
    b2.insert(Tix.END, '14')
    b2.insert(Tix.END, '18')

    b1.pick(1)
    b2.pick(3)

    b1.pack(side=Tix.LEFT, padx=4, pady=4)
    b2.pack(side=Tix.LEFT, padx=4, pady=4)

    demo.balloon.bind_widget(b1,
                             msg='Choose\na font',
                             statusmsg='Choose a font for this page')
    demo.balloon.bind_widget(b2,
                             msg='Point size',
                             statusmsg='Choose the font size for this page')
    return w
コード例 #15
0
    def ProbBoundCond(self, w):
        #user_fn = Tix.StringVar()
        self.bc = Tix.ComboBox(
            w,
            label=" ",
            dropdown=0,
            command=lambda w=w: self.select_bound(w),
            editable=0,
            variable=self.boundType,
            options=
            'listbox.height 3 label.padY 5 label.width 10 label.anchor ne')
        self.bc.pack(side=Tix.TOP, anchor=Tix.W)
        self.bc.insert(Tix.END, 'Dirichlet only')
        self.bc.insert(Tix.END, 'Arbitrary Mixed Dirichlet/Neumann')
        self.bc.insert(Tix.END, 'Random Mixed Dirichlet/Neumann')
        self.bc.insert(Tix.END, 'Neumann only')
        #implement a view function

        self.bc.set_silent('Dirichlet only')
        self.bc.pack(fill=Tix.X, padx=5, pady=3)
コード例 #16
0
    def create_main_widgets(self):

        combo_box = Tix.ComboBox(self)
        combo_box.grid(column=0, row=0, sticky='news', padx=4, pady=4)

        button_box = Tix.ButtonBox(self)
        button_box.add('button_1', text='Button_1')
        button_box.add('button_2', text='Button_2')
        button_box.grid(column=0, row=1, sticky='news', padx=4, pady=4)

        control = Tix.Control(self)
        control.grid(column=0, row=2, sticky='news', padx=4, pady=4)

        label_entry = Tix.LabelEntry(self, label="Label for entry")
        label_entry.grid(column=0, row=3, sticky='news', padx=4, pady=4)

        meter = Tix.Meter(self)
        meter.grid(column=0, row=4, sticky='news', padx=4, pady=4)

        options = Tix.OptionMenu(self)
        options.grid(column=0, row=5, sticky='news', padx=4, pady=4)

        file_entry = Tix.FileEntry(self)
        file_entry.grid(column=0, row=6, sticky='news', padx=4, pady=4)
コード例 #17
0
ファイル: wid_specgram.py プロジェクト: pyfusion/pyfusion
    def ShotWid():
        """ this simple widget accepts a shot and sets the current one
        It is a function in the IntegerCtl class, so it communicates with
        its vars easily and calls do_shot to update the shot.  THe
        shot pulldown stops working in python (ordinary) after 1
        pulldown?

        """
        global hist_box, select_box, wild_box
        #        root=Tix.Tk(className='ShotSelect')  # was here but needs to
        #        be in effect before Tix.StringVar() is called
        top = Tix.Frame(root, bd=1, relief=Tix.RAISED)
        hist_box = Tix.ComboBox(top,
                                label="Shot",
                                editable=True,
                                history=True,
                                variable=shot_string,
                                command=do_shot,
                                options='entry.width 8 listbox.height 10 ')
        hist_box.pack(side=Tix.TOP, anchor=Tix.W)
        hist_box.set_silent('33373')
        hist_balloon = Tix.Balloon(top)
        hist_balloon.bind_widget(
            hist_box,
            balloonmsg='Choose or enter shot number, valid ones are saved here'
        )

        wild_box = Tix.ComboBox(top,
                                label="Filter",
                                editable=1,
                                history=1,
                                variable=wild_string,
                                command=update_select,
                                options='entry.width 20 listbox.height 5 '
                                )  # allow room for expressions
        wild_box.pack(side=Tix.TOP, anchor=Tix.W)
        wild_balloon = Tix.Balloon(top)
        wild_balloon.bind_widget(
            wild_box,
            balloonmsg='Choose or enter new filter in one of three forms,' +
            'a Python expression (must have () or []), ' +
            'a directory specification including a * or ' +
            'the name of a file containing lines beginning with a shot number. '
            'Results can be chosen using "Filtered Shots"')

        select_box = Tix.ComboBox(top,
                                  label="Filtered Shots",
                                  history=False,
                                  variable=select_string,
                                  command=do_shot,
                                  options='entry.width 8 listbox.height 40 ')
        btn = Tix.Button(select_box, text='Clear', command=clear_select)
        btn.pack(anchor=Tix.CENTER)
        select_box.pack(side=Tix.TOP, anchor=Tix.W)
        select_balloon = Tix.Balloon(top)
        select_balloon.bind_widget(
            select_box,
            balloonmsg='pull down to find a shot selected by "Filter""')
        #wild_box.set_silent('MP1')  # not silent - want it all to happen, but setvar doesn't work

        update_select(partial_name=wild_card)

        top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
コード例 #18
0
    def ProbFunc(self, w):
        self.f_list = Tix.ComboBox(
            w,
            label="Function List: ",
            dropdown=0,
            command=lambda w=w: self.selectFunc(w),
            editable=1,
            variable=self.func,
            options=
            'listbox.height 3 label.padY 5 label.width 10 label.anchor ne')
        self.f_list.pack(side=Tix.TOP, anchor=Tix.W)
        self.f_list.insert(Tix.END, 'y**2*sin(pi*x)')
        self.f_list.insert(Tix.END, '((x-0.5)**2 + (y-0.5)**2 +1)**(1/2.0)')
        self.f_list.insert(Tix.END, 'cos(x*2*pi)*sin(y*2*pi)')
        self.f_list.insert(Tix.END, 'exp(-x)*(x+y**3)')
        self.f_list.insert(Tix.END, 'ln(1+(x-0.5)**2 +(y-0.5)**2)')
        self.f_list.set_silent('y**2*sin(pi*x)')
        self.f_list.pack(fill=Tix.X, padx=5, pady=3)
        x_order = Tix.DoubleVar()
        y_order = Tix.IntVar()
        #radio buttons decide whether the function is assigned to solution or source
        self.func_assign_option = Tix.Select(w,
                                             label='Assign function to:',
                                             allowzero=1,
                                             radio=1)
        self.func_assign_option.add(
            'solution', text='Solution')  #command=self.setSolAssign())
        self.func_assign_option.add('source', text='Source Function')
        self.func_assign_option.subwidget_list['solution'].invoke()
        self.func_assign_opt = self.func_assign_option["value"]

        xn = Tix.Control(w,
                         label='x order: ',
                         integer=1,
                         variable=x_order,
                         min=0,
                         max=3,
                         command=lambda w=w: self.select_X_order(w),
                         options='entry.width 5 label.width 6 label.anchor e')
        yn = Tix.Control(w,
                         label='y order: ',
                         integer=1,
                         variable=y_order,
                         min=0,
                         max=3,
                         command=lambda w=w: self.select_Y_order(w),
                         options='entry.width 5 label.width 6 label.anchor e')

        xn.pack(side=Tix.LEFT, padx=5, pady=3, fill=Tix.X)
        yn.pack(side=Tix.LEFT, padx=5, pady=3, fill=Tix.X)
        box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL)
        box.add('diff',
                text='Differentiate',
                underline=0,
                width=9,
                command=self.differentiate_fn)
        box.pack(side=Tix.BOTTOM, padx=5, pady=3, fill=Tix.X)
        self.func_assign_option.pack(side=Tix.BOTTOM,
                                     padx=5,
                                     pady=3,
                                     fill=Tix.X)
コード例 #19
0
    def __init__(self, parent=None):
        self.myparent = parent
        self.myroot = self.myparent.myparent
        self.tempomaybe = copy.deepcopy(self.myparent.tempolist)
        self.tempofr = tk.Toplevel(self.myroot, width=480, height=360)
        self.tempofr.title("Tempo Changes")
        self.tempofr.rowconfigure(0, weight=1)
        self.tempofr.rowconfigure(1, weight=0)
        self.tempofr.columnconfigure(0, weight=1)
        self.tempobuttons = tk.ButtonBox(self.tempofr, width=480, height=360)
        self.tempobuttons.add('ok', text='OK', command=self.ok)
        self.tempobuttons.add('cancel', text='Cancel', command=self.cancel)
        self.tempobuttons.add('apply', text='Apply', command=self.apply)
        self.tempobuttons.add('sort', text='Sort', command=self.reorder)
        self.tempobuttons.grid(row=1, column=0, sticky='')
        self.canvas = tk.Canvas(self.tempofr, width=480, height=360)
        self.canvas.grid(row=0, column=0, sticky='nesw')
        self.canvas.rowconfigure(2, weight=1)
        self.canvas.columnconfigure(0, weight=1)
        self.toprow = tk.Frame(self.canvas)
        self.toprowoncanvas = self.canvas.create_window(0,
                                                        0,
                                                        window=self.toprow,
                                                        anchor="nw")
        self.toprow.columnconfigure(0, weight=0)
        self.toprow.columnconfigure(1, weight=1)
        self.botrow = tk.Frame(self.canvas, bd=3, relief="ridge")
        #        self.botrow.grid(row=1, column=0, sticky='we')
        self.botrow.columnconfigure(0, weight=0)
        self.botrow.columnconfigure(1, weight=1)
        bottomy = self.toprow.winfo_reqheight()
        #        print bottomy
        self.botrowoncanvas = self.canvas.create_window(0,
                                                        bottomy,
                                                        window=self.botrow,
                                                        anchor="nw")
        self.tempolinelist = []

        #        print self.tempomaybe
        self.scroll = tk.Scrollbar(self.tempofr,
                                   orient='vertical',
                                   takefocus=0)
        self.canvas.config(yscrollcommand=self.scroll.set)
        self.canvas.config(scrollregion=self.canvas.bbox("all"))
        self.scroll.config(command=self.canvas.yview)
        self.tempofr.bind("<Button-4>",
                          lambda event, arg1="scroll", arg2=-1, arg3="units":
                          self.canvas.yview(arg1, arg2, arg3),
                          "+")
        self.tempofr.bind("<Button-5>",
                          lambda event, arg1="scroll", arg2=1, arg3="units":
                          self.canvas.yview(arg1, arg2, arg3),
                          "+")
        for tempo in self.tempomaybe:
            number = self.tempomaybe.index(tempo)
            newline = self.addtempoline(tempo, number)

        self.addbar = tk.IntVar()
        self.addbeat = tk.IntVar()
        self.addbpm = tk.DoubleVar()
        self.addunit = tk.IntVar()
        self.blankbar = tk.Entry(self.botrow,
                                 width=4,
                                 textvariable=self.addbar)
        self.blankbar.focus_set()
        self.blankbar.select_range(0, "end")
        self.blankbar.grid(padx=10, sticky='')
        self.blankbeat = tk.Entry(self.botrow,
                                  width=3,
                                  textvariable=self.addbeat)
        self.blankbeat.grid(row=0, column=1, padx=10, sticky='')
        self.blankbpm = tk.Entry(self.botrow,
                                 width=5,
                                 textvariable=self.addbpm)
        self.blankbpm.grid(row=0, column=2, padx=10, sticky='')
        self.blankunit = tk.ComboBox(self.botrow,
                                     editable=1,
                                     variable=self.addunit,
                                     listwidth=8)
        self.blankunit.entry.configure(width=3)
        self.blankunit.append_history(1)
        self.blankunit.append_history(2)
        self.blankunit.append_history(3)
        self.blankunit.append_history(4)
        self.blankunit.append_history(6)
        self.blankunit.append_history(8)
        self.blankunit.append_history(12)
        self.blankunit.append_history(16)
        self.blankunit.grid(row=0, column=3, padx=10, sticky='')

        self.blankaddtempo = tk.Button(self.botrow,
                                       text="Add Tempo",
                                       command=self.newtempo)
        self.blankaddtempo.grid(row=0, column=4, padx=10, rowspan=1)

        self.tempofr.update_idletasks()
        self.tempofr.bind("<Return>", self.ok)
        self.tempofr.bind("<Escape>", self.cancel)
コード例 #20
0
    def __init__(self, parent, tempo, bar, beat, bpm, unit, number):
        self.myparent = parent
        self.tempo = tempo
        self.number = number
        self.frame = tk.Frame(self.myparent.toprow, bd=4, relief='ridge')
        self.frame.grid(row=self.number, column=0, sticky='ew')
        self.bar = tk.IntVar()
        self.bar.set(bar)
        self.bar.trace("w", self.barchange)
        self.barlabel = tk.Label(self.frame, text="Bar:")
        self.barlabel.grid(row=0, column=0, padx=4, sticky='e')
        self.barwidget = tk.Control(self.frame,
                                    min=1,
                                    max=99999,
                                    width=4,
                                    variable=self.bar)
        self.barwidget.grid(row=0, column=1, padx=4, sticky='')
        self.beat = tk.IntVar()
        self.beat.set(beat)
        self.beat.trace("w", self.beatchange)
        self.beatlabel = tk.Label(self.frame, text="Beat:")
        self.beatlabel.grid(row=0, column=2, padx=4, sticky='e')
        self.beatwidget = tk.Control(self.frame,
                                     min=1,
                                     max=32,
                                     width=2,
                                     variable=self.beat)
        self.beatwidget.grid(row=0, column=3, padx=4, sticky='')
        self.bpm = tk.DoubleVar()
        self.bpm.set(bpm)
        self.bpm.trace("w", self.bpmchange)
        self.bpmlabel = tk.Label(self.frame, text="BPM:")
        self.bpmlabel.grid(row=0, column=4, padx=4, sticky='e')
        self.bpmwidget = tk.Entry(self.frame, width=4, textvariable=self.bpm)
        self.bpmwidget.grid(row=0, column=5, padx=4)
        self.unit = tk.IntVar()
        self.unit.set(unit)
        self.unit.trace("w", self.unitchange)
        self.unitlabel = tk.Label(self.frame, text="Unit:")
        self.unitlabel.grid(row=0, column=6, padx=4, sticky='e')
        self.unitwidget = tk.ComboBox(self.frame,
                                      variable=self.unit,
                                      editable=0)
        self.unitwidget.entry.configure(width=3)
        self.unitwidget.append_history(1)
        self.unitwidget.append_history(2)
        self.unitwidget.append_history(3)
        self.unitwidget.append_history(4)
        self.unitwidget.append_history(6)
        self.unitwidget.append_history(8)
        self.unitwidget.append_history(12)
        self.unitwidget.append_history(16)

        self.unitwidget.entry.configure(width=3)
        #        for value in ('Sixteenth', 'Dotted Sixteenth', 'Eighth', 'Dotted Eighth', 'Quarter', 'Dotted Quarter', 'Half', 'Dotted Half', 'Whole'):
        #            self.unitwidget.append_history(value)
        self.unitwidget.grid(row=0, column=7, padx=4, sticky='')
        self.x = tk.Button(self.frame,
                           text="x",
                           padx=0,
                           pady=0,
                           command=self.remove)
        self.x.grid(row=0, column=8, sticky='e', padx=40)

        self.myparent.tempofr.update_idletasks()
        bottomy = self.myparent.toprow.winfo_reqheight()
        #        print bottomy

        self.myparent.canvas.coords(self.myparent.botrowoncanvas, 0, bottomy)
        if self.myparent.scroll.winfo_ismapped():
            #            print self.page.scroll.get()
            pass
        else:
            self.myparent.tempofr.update_idletasks()
            #            print self.page.scroll.get()
            if self.myparent.scroll.get() != (0.0, 1.0):
                self.myparent.scroll.grid(row=1, column=1, sticky='ns')

        self.myparent.canvas.config(
            scrollregion=self.myparent.canvas.bbox("all"))
        self.myparent.canvas.yview_moveto(1.0)
        if self.myparent.scroll.winfo_ismapped():
            #            print self.page.scroll.get()
            pass
        else:
            self.myparent.tempofr.update_idletasks()
            #            print self.page.scroll.get()
            if self.myparent.scroll.get() != (0.0, 1.0):
                self.myparent.scroll.grid(row=0, column=1, sticky='ns')
コード例 #21
0
    def __init__(self, root, **kwargs):
        Frame.__init__(self, root, width=1000, height=1000, **kwargs)
        root.geometry("395x320")
        root.title("Pilotage")

        # Création des onglets
        monnotebook = Tix.NoteBook(root)
        monnotebook.add("page1", label="Configuration")
        monnotebook.add("page2", label="Velocity Mode")
        monnotebook.add("page3", label="Motion Task")

        p1 = monnotebook.subwidget_list["page1"]
        p2 = monnotebook.subwidget_list["page2"]
        p3 = monnotebook.subwidget_list["page3"]

        fra1 = Canvas(p1)
        fra2 = Canvas(p2)
        fra3 = Canvas(p3)

        fra1.pack(expand=1, fill=Tix.BOTH)
        fra2.pack(expand=1, fill=Tix.BOTH)
        fra3.pack(expand=1, fill=Tix.BOTH)
        # fin création des onglets

        # Début onglet 1
        # create a frame in canvas(p1)
        sous_fra = Frame(fra1, width=400, borderwidth=2, relief=GROOVE)
        self.portLabel = Label(sous_fra, text="Serial ser:")  # create a label
        # create a variable, it will contain ser selection
        self.myPortCombo = Tix.StringVar()

        self.actuatorNameCombo = Tix.StringVar()
        # create a combobox, it will contain names of ports
        self.actuatorCombo = Tix.ComboBox(sous_fra,
                                          editable=1,
                                          dropdown=1,
                                          variable=self.actuatorNameCombo)
        # configure the combobox in read only
        self.actuatorCombo.entry.config(state='readonly')
        for m in actuator_list:
            self.actuatorCombo.insert(0, m)

        self.actuatorLabel = Label(sous_fra, text="Actuator name:")
        self.portCombo = Entry(sous_fra, textvariable=self.myPortCombo)
        self.baudrateLabel = Label(sous_fra,
                                   text="Baudrate:")  # create a label
        # create a variable, it will contain baudrate selection
        self.baudCombo = Tix.StringVar()
        self.baudrateCombo = Entry(sous_fra, textvariable=self.baudCombo)
        self.num_device = Tix.IntVar()
        # create a label
        self.num_device_label = Label(sous_fra, text="Device number:")
        self.num_device_entry = Spinbox(sous_fra,
                                        from_=1,
                                        to=10,
                                        textvariable=self.num_device)
        self.actuatorNameCombo.trace('w', self.callback)
        # create connect Button
        self.connection = Button(sous_fra,
                                 text="Connect",
                                 command=self.connection)
        sous_fra1 = Frame(fra1,
                          width=400)  # create a second frame in canvas(p1)
        # create examine location button
        self.location = Button(sous_fra1,
                               text="Examine location",
                               command=self.examineLocation,
                               width=10)
        self.location.config(
            state='disabled')  # disable the state of the button
        # create 'location:' label
        locationLabel = Label(sous_fra1, text="Location:")
        # create a variable, it will contain the result of examineLocation method
        self.Resultat = StringVar()
        self.Resultat.set("0")  # set the variable to zero
        # create a label, it will show the variable
        resultatLabel = Label(sous_fra1, textvariable=self.Resultat)
        self.resetZero = Button(sous_fra1,
                                text=" Reset ",
                                command=self.reset_servostar)
        # create cancel button
        self.quit = Button(sous_fra1, text="Cancel", command=root.quit)
        # Fin onglet 1

        # Début onglet 2
        # create a frame in canvas(p2)
        sous_fra2 = Frame(fra2, width=400)
        # create a second fram in canvas(p2)
        sous_fra2bis = Frame(fra2, width=400)
        # create a variable, it will contain the value of speedEntry
        self.speedVar = StringVar()
        # create 'Velocity:' label
        speedLabel = Label(sous_fra2bis, text="Velocity:")
        # create an entry, it will contain a velocity choose by the user
        speedEntry = Entry(sous_fra2bis, textvariable=self.speedVar, width=5)
        # create a advance button
        self.advanceButton = Button(sous_fra2bis,
                                    text="advance",
                                    command=self.advance,
                                    width=10)
        # disable the state of the button
        self.advanceButton.config(state='disabled')
        # create recoil button
        self.recoilButton = Button(sous_fra2bis,
                                   text="recoil",
                                   command=self.recoil,
                                   width=10)
        # disable the state of the button
        self.recoilButton.config(state='disabled')
        # create stop button
        self.stopVMButton = Button(sous_fra2bis,
                                   text="STOP",
                                   command=self.stopMotion,
                                   width=10)
        self.stopVMButton.config(state='disabled')
        self.defineZeroButton = Button(sous_fra2bis,
                                       text="Define Zero",
                                       command=self.defineZero,
                                       width=10)
        self.defineZeroButton.config(state='disabled')
        # Début onglet 3
        sous_fra3_2 = Frame(fra3, width=400)  # create a frame in canvas(p3)
        self.moveZeroButton = Button(sous_fra3_2,
                                     text="Move Home",
                                     command=self.moveZero,
                                     width=15)  # create move home button
        # disable the state of the button
        self.moveZeroButton.config(state='disabled')

        # create 'position:' label
        positionLabel = Label(sous_fra3_2, text="position :")
        # create a variable, it will contain the value of entry2
        self.position = StringVar()
        # create an entry, it will contain the positon choose by the user
        self.entry2 = Entry(sous_fra3_2, textvariable=self.position)
        # pick out the widget that will receive keyboard events
        self.entry2.focus_set()

        speed_label = Label(sous_fra3_2,
                            text="speed:")  # create 'position:' label
        # create a variable, it will contain the value of entry2
        self.speed = StringVar()
        # create an entry, it will contain the positon choose by the user
        self.entry3 = Entry(sous_fra3_2, textvariable=self.speed)
        # pick out the widget that will receive keyboard events
        self.entry3.focus_set()

        # create 'motionType:' label
        motionTypeLabel = Label(sous_fra3_2, text="motion type :")
        # create a variable, it will contain the value of entry4
        self.motionType = StringVar()

        sous_fra3 = Frame(fra3, width=400)  # create a frame in canvas(p3)
        sous_sous_fra3 = Frame(sous_fra3,
                               width=400)  # create a frame in sous_fra3
        # create move button
        self.moveButton = Button(sous_sous_fra3,
                                 text="Move",
                                 command=self.move)
        self.moveButton.config(
            state='disabled')  # disable the state of the button
        # create STOP button
        self.stopMTButton = Button(sous_sous_fra3,
                                   text="STOP",
                                   command=self.stopMotion)
        self.stopMTButton.config(state='disabled')
        # create a second frame in sous_fra3
        sous_sous_fra3bis = Frame(sous_fra3, width=400)
        # placement des widgets onglet 1
        # show widgets on canvas(p1)
        sous_fra.grid(padx=10, pady=10)  #
        self.portLabel.grid(row=1, column=0, sticky="sw", padx=10, pady=10)
        self.portCombo.grid(row=1, column=1, sticky="sw", padx=10, pady=10)
        self.baudrateLabel.grid(row=2, column=0, sticky="sw", padx=10, pady=10)
        self.baudrateCombo.grid(row=2, column=1, sticky="sw", padx=10, pady=10)
        self.actuatorLabel.grid(row=3, column=0, sticky="sw", padx=10, pady=10)
        self.actuatorCombo.grid(row=3, column=1, sticky="sw", padx=10, pady=10)
        self.connection.grid(row=5, column=1, sticky="se")
        # placement widget sous frame onglet 1
        # show widgets on frame canvas(p1)
        sous_fra1.grid()
        # self.enable.grid(row=1, column=0,sticky= "sw", padx=10,pady=10)
        # self.disable.grid(row=2, column=0,sticky= "sw", padx=10,pady=10)
        # self.resetZero.grid(row=3, column=0,sticky= "sw", padx=10,pady=10)
        self.location.grid(row=5, column=0, sticky="s", padx=10, pady=10)
        locationLabel.grid(row=5, column=1)
        resultatLabel.grid(row=5, column=2)
        self.resetZero.grid(row=5, column=4)
        # self.quit.grid(row=4, column=4, sticky= "e")

        # placement des widgets onglet 2
        # show widgets on canvas(p2)
        sous_fra2.grid(row=0, column=0, padx=10, pady=10)
        sous_fra2bis.grid(row=1, column=0, padx=10, pady=10)
        # self.init_modeButton.grid(row=0, column=0, padx=10,pady=10)
        speedLabel.grid(row=0, column=0, sticky='w')
        speedEntry.grid(row=0, column=2, sticky='w')
        self.recoilButton.grid(row=0, column=3, sticky='w')
        self.advanceButton.grid(row=1, column=3, sticky='w')
        self.stopVMButton.grid(row=2, column=3, sticky='w')
        self.defineZeroButton.grid(row=3, column=3, sticky='w')

        # placement des widgets onglet 3
        #  show widgets on canvas(p3)
        sous_fra3_2.grid(padx=10, pady=10)
        self.moveZeroButton.grid(row=0, column=0, padx=10, pady=10)
        positionLabel.grid(row=1, column=0, sticky='w')
        speed_label.grid(row=2, column=0, sticky='w')
        motionTypeLabel.grid(row=3, column=0, sticky='w')
        self.entry2.grid(row=1, column=1, sticky='w')
        self.entry3.grid(row=2, column=1, sticky='w')
        Radiobutton(sous_fra3_2,
                    text="absolute",
                    variable=self.motionType,
                    value=True).grid()
        Radiobutton(sous_fra3_2,
                    text="relative",
                    variable=self.motionType,
                    value=False).grid()
        sous_fra3.grid(row=3, column=0)
        sous_sous_fra3.grid(row=0, column=0)
        sous_sous_fra3bis.grid(row=1, column=0)
        self.moveButton.grid(row=0, column=1)
        self.stopMTButton.grid(row=0, column=2)
        # show notebooks
        monnotebook.pack(side=LEFT, fill=Tix.BOTH, expand=1, padx=5, pady=5)
コード例 #22
0
    def __init__(self, parent, bindir):
        self.root = parent
        self.bindir = bindir
        self.choices_ts = [
            'Displacement (filtered)', 'Acceleration (filtered)',
            'Acceleration (unfiltered)'
        ]
        self.hist_old = self.choices_ts[0]
        self.spec_old = self.choices_ts[1]
        self.p = {}  # dictionary to hold all Tk variables
        self.p['pmax'] = Tk.IntVar()
        self.p['pmax'].set(0)
        self.p['fltrng'] = Tk.IntVar()
        self.p['fltrng'].set(1)
        self.p['cutrng'] = Tk.IntVar()
        self.p['cutrng'].set(1)
        self.p['pltlog2'] = Tk.IntVar()
        self.p['pltlog2'].set(0)
        self.p['pltgrid'] = Tk.IntVar()
        self.p['pltgrid'].set(1)
        if self.bindir is None:
            self.choose_bin_directory()
        if self.bindir == '':
            sys.exit()

        ### Window layout setup
        self.root = parent
        self.entry_frame = Tk.Frame(root)
        self.entry_frame.pack(side='top', pady=5)
        self.eq_frame = Tk.Frame(root, borderwidth=2, relief='sunken')
        self.eq_frame.pack(side='top', fill=Tk.BOTH, expand=0)
        self.figure_frame = Tk.Frame(root)
        self.figure_frame.pack(side='top', anchor='n', expand=1, fill=Tk.BOTH)
        self.left_frame = Tk.Frame(self.figure_frame)
        self.left_frame.pack(side='left', anchor='n', expand=1, fill=Tk.BOTH)
        self.right_frame = Tk.Frame(self.figure_frame)
        self.right_frame.pack(side='left', anchor='n', expand=1, fill=Tk.BOTH)
        self.nav_frame = Tk.Frame(self.figure_frame)
        self.nav_frame.pack(side='right',
                            anchor='center',
                            expand=0,
                            fill='none')
        self.root.wm_title("Strong motion analyser")
        self.f1 = Figure(figsize=(5., 5.), dpi=100)
        self.f2 = Figure(figsize=(6.4, 5.), dpi=100)
        self.canvas1 = FigureCanvasTkAgg(self.f1, master=self.left_frame)
        self.canvas2 = FigureCanvasTkAgg(self.f2, master=self.right_frame)
        self.canvas1.show()
        self.canvas1.get_tk_widget().pack(side='left', expand=1, fill=Tk.BOTH)
        self.canvas2.get_tk_widget().pack(side='left', expand=1, fill=Tk.BOTH)
        toolbar = NavigationToolbar2TkAgg(self.canvas1, self.left_frame)
        toolbar.update()
        self.canvas1._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
        toolbar1 = NavigationToolbar2TkAgg(self.canvas2, self.right_frame)
        toolbar1.update()
        self.canvas2._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)

        DataHandler.__init__(self, self.bindir)
        PlotIterator.__init__(self)

        # Make initial plot of first record
        self.plotcanvas()

        # set line length of input file; needed to add comments to line
        # set number of points variable
        self.p['starttrim'] = Tk.IntVar()
        self.p['starttrim'].set(self.startt)
        self.p['endtrim'] = Tk.IntVar()
        self.p['endtrim'].set(self.endt)
        self.p['demean'] = Tk.IntVar()
        self.p['demean'].set(self.dmn)
        self.p['detrend'] = Tk.IntVar()
        self.p['detrend'].set(self.dtrnd)

        # set filter to default filter
        self.p['hlow'] = Tk.DoubleVar()
        self.p['hlow'].set(self.highp[0])
        self.p['hhgh'] = Tk.DoubleVar()
        self.p['hhgh'].set(self.highp[1])

        # setting up spin boxes for cutting
        trim_cntrl_st = Tk.Control(self.entry_frame,
                                   label='start',
                                   integer=True,
                                   step=1,
                                   variable=self.p['starttrim'])
        trim_cntrl_st.entry.config(font=10)
        trim_cntrl_st.label.config(font=10)
        trim_cntrl_st.pack(side='left', padx=5)

        trim_cntrl_ed = Tk.Control(self.entry_frame,
                                   label='end',
                                   integer=True,
                                   step=1,
                                   variable=self.p['endtrim'])
        trim_cntrl_ed.entry.config(font=10)
        trim_cntrl_ed.label.config(font=10)
        trim_cntrl_ed.pack(side='left', padx=5)

        # setting up trim button
        trim_button = Tk.Button(self.entry_frame,
                                text='Cut',
                                width=8,
                                command=self.recalc,
                                font=10)
        trim_button.pack(side='left', padx=10)

        # setting up spin boxes for filtering
        hp_cntrl_lw = Tk.Control(self.entry_frame,
                                 label='cutoff',
                                 max=10,
                                 min=0,
                                 integer=False,
                                 step=0.01,
                                 variable=self.p['hlow'])
        hp_cntrl_lw.entry.config(font=10)
        hp_cntrl_lw.label.config(font=10)
        hp_cntrl_lw.pack(side='left', padx=5)
        hp_cntrl_hg = Tk.Control(self.entry_frame,
                                 label='corner',
                                 max=10,
                                 min=0,
                                 integer=False,
                                 step=0.01,
                                 variable=self.p['hhgh'])
        hp_cntrl_hg.entry.config(font=10)
        hp_cntrl_hg.label.config(font=10)
        hp_cntrl_hg.pack(side='left', padx=5)

        # setting up filter button
        flt_button = Tk.Button(self.entry_frame,
                               text='Filter',
                               width=8,
                               command=self.recalc,
                               font=10)
        flt_button.pack(side='left', padx=10)

        # setting up combo box for spectra
        spec_box = Tk.ComboBox(self.entry_frame,
                               label='Spectra',
                               editable=False,
                               dropdown=True,
                               command=self.choose_spec,
                               value=self.choices_ts[1])
        spec_box.insert('end', self.choices_ts[0])
        spec_box.insert('end', self.choices_ts[1])
        spec_box.insert('end', self.choices_ts[2])
        spec_box.label.config(font=10)
        spec_box.entry.config(font=10)
        #spec_box.listbox.config(font=10)
        spec_box.pack(side='left', padx=10)

        # setting up combo box for timeseries
        hist_box = Tk.ComboBox(self.entry_frame,
                               label='Timeseries',
                               editable=False,
                               dropdown=True,
                               command=self.choose_ts,
                               value=self.choices_ts[0])
        hist_box.insert('end', self.choices_ts[0])
        hist_box.insert('end', self.choices_ts[1])
        hist_box.insert('end', self.choices_ts[2])
        hist_box.label.config(font=10)
        hist_box.entry.config(font=10)
        hist_box.pack(side='left', padx=10)

        # setting up earthquake info frame
        self.evtime = Tk.Label(self.eq_frame,
                               text='Event time: %s' % self.v2.stream[0].stats.
                               smdict.eventtime.strftime("%d/%m/%Y %H:%M:%S"),
                               font=10,
                               padx=20)
        self.evtime.pack(side='left')
        self.eqdist = Tk.Label(self.eq_frame,
                               text='Epicentral distance: %d km' %
                               self.v2.stream[0].stats.smdict.epicdist,
                               font=10,
                               padx=20)
        self.eqdist.pack(side='left')
        self.hdep = Tk.Label(self.eq_frame,
                             text='Hypocentral depth: %d km' %
                             self.v2.stream[0].stats.smdict.hypodep,
                             font=10,
                             padx=20)
        self.hdep.pack(side='left')
        self.lmag = Tk.Label(self.eq_frame,
                             text='Local magnitude: %.2f' %
                             self.v2.stream[0].stats.smdict.Ml,
                             font=10,
                             padx=20)
        self.lmag.pack(side='left')
        a = self.data[0].split()
        fname = a[0].split('_')
        if len(fname) > 3:
            # building site
            self.sensname = fname[2] + "/" + fname[3]
        else:
            # single instrument accelerometer
            self.sensname = fname[2]

        self.sens = Tk.Label(self.eq_frame,
                             text='Sensor name: %s' % self.sensname,
                             font=10,
                             padx=20)
        self.sens.pack(side='left')

        # setting up navigation and save button
        p_button = Tk.Button(self.nav_frame,
                             text='Previous',
                             width=8,
                             command=self.prev,
                             font=10)
        p_button.pack(side='top', fill='x', anchor='center')
        n_button = Tk.Button(self.nav_frame,
                             text='Next',
                             width=8,
                             command=self.next,
                             font=10)
        n_button.pack(side='top', fill='x', anchor='center')
        n_button = Tk.Button(self.nav_frame,
                             text='Save',
                             width=8,
                             command=self.savefile,
                             font=10)
        n_button.pack(side='top', fill='x', anchor='center')

        # setting up radio buttons
        detrend = Tk.Checkbutton(self.nav_frame,
                                 text='Detrend',
                                 command=self.recalc,
                                 variable=self.p['detrend'],
                                 indicatoron=0,
                                 width=4,
                                 font=10)
        detrend.pack(side='top', fill='x', anchor='center')
        baldetrend = Tk.Balloon(self.nav_frame)
        baldetrend.bind_widget(
            detrend,
            balloonmsg=
            'Choose whether to subtract linear trend from Volume 1 acceleration timeseries.'
        )

        demean = Tk.Checkbutton(self.nav_frame,
                                text='Demean',
                                command=self.recalc,
                                variable=self.p['demean'],
                                indicatoron=0,
                                width=4,
                                font=10)
        demean.pack(side='top', fill='x', anchor='center')
        baldemean = Tk.Balloon(self.nav_frame)
        baldemean.bind_widget(
            demean,
            balloonmsg=
            'Choose whether to subtract mean from Volume 1 acceleration timeseries.'
        )

        maxb = Tk.Checkbutton(self.nav_frame,
                              text='Max',
                              command=self.plotmax,
                              variable=self.p['pmax'],
                              indicatoron=0,
                              width=4,
                              font=10)
        maxb.pack(side='top', fill='x', anchor='center')
        balmaxb = Tk.Balloon(self.nav_frame)
        balmaxb.bind_widget(maxb, balloonmsg='Plot maxima of timeseries.')

        fltrng = Tk.Checkbutton(self.nav_frame,
                                text='Fltrng',
                                command=self.plotfltrng,
                                variable=self.p['fltrng'],
                                indicatoron=0,
                                width=4,
                                font=10)
        fltrng.pack(side='top', fill='x', anchor='center')
        balfltrng = Tk.Balloon(self.nav_frame)
        balfltrng.bind_widget(
            fltrng,
            balloonmsg='Plot cutoff and corner frequencies of highpass filter.'
        )

        cutrng = Tk.Checkbutton(self.nav_frame,
                                text='Cutrng',
                                command=self.plotmax,
                                variable=self.p['cutrng'],
                                indicatoron=0,
                                width=4,
                                font=10)
        cutrng.pack(side='top', fill='x', anchor='center')
        balcutrng = Tk.Balloon(self.nav_frame)
        balcutrng.bind_widget(cutrng, balloonmsg='Plot cutting window.')

        pltlog2 = Tk.Checkbutton(self.nav_frame,
                                 text='log2',
                                 command=self.plotfltrng,
                                 variable=self.p['pltlog2'],
                                 indicatoron=0,
                                 width=4,
                                 font=10)
        pltlog2.pack(side='top', fill='x', anchor='center')
        balpltlog2 = Tk.Balloon(self.nav_frame)
        balpltlog2.bind_widget(
            pltlog2,
            balloonmsg=
            'Plot line with slope 2.0 through the maximum of the power spectrum.'
        )

        pltgrid = Tk.Checkbutton(self.nav_frame,
                                 text='Grid',
                                 command=self.plotfltrng,
                                 variable=self.p['pltgrid'],
                                 indicatoron=0,
                                 width=4,
                                 font=10)
        pltgrid.pack(side='top', fill='x', anchor='center')
        balpltgrid = Tk.Balloon(self.nav_frame)
        balpltgrid.bind_widget(pltgrid, balloonmsg='Plot grid lines.')

        # setting up comment button
        self.p['comment'] = Tk.StringVar()
        cmnt_button = Tk.Button(self.nav_frame,
                                text='Comment',
                                width=8,
                                command=self.add_comment,
                                font=10)
        cmnt_button.pack(side='top', fill='x', anchor='center')
        cmnt_ent = Tk.Entry(self.nav_frame,
                            textvariable=self.p['comment'],
                            width=8)
        cmnt_ent.pack(side='top', fill='x', anchor='center')
        balcmnt = Tk.Balloon(self.nav_frame)
        balcmnt.bind_widget(
            cmnt_button,
            balloonmsg=
            'Add a comment to the corresponding line in the input file.')
コード例 #23
0
def mainScreen(fenetre, callBack):

    #fenetre.maxsize(500, 300)

    list = fenetre.pack_slaves()
    for l in list:
        l.destroy()

    p = PanedWindow(fenetre, orient=VERTICAL)
    p.pack(side=TOP, expand=Y, fill=BOTH, pady=2, padx=2)

    frame_serial = Frame(fenetre, borderwidth=2, relief=GROOVE)
    frame_led = Frame(fenetre, borderwidth=2, relief=GROOVE)
    frame_alarme = Frame(fenetre, borderwidth=2, relief=GROOVE)
    frame_LCD1 = Frame(fenetre, borderwidth=2, relief=GROOVE)
    frame_LCD2 = Frame(fenetre, borderwidth=2, relief=GROOVE)
    frame_singleAction = Frame(fenetre, borderwidth=2, relief=GROOVE)
    frame_input = Frame(fenetre, borderwidth=2, relief=GROOVE)

    if callBack.connect == False:
        Label(frame_serial, text="port COM :").pack(side=LEFT,
                                                    padx=10,
                                                    pady=10)
        varcombo = Tix.StringVar()
        listbox = Tix.ComboBox(frame_serial, variable=varcombo)
        allPort = callBack.getAllSerial()
        for ser in allPort:
            listbox.insert(END, str(ser.device))
        if len(allPort) > 0:
            varcombo.set(allPort[0].device)
        listbox.pack(side=LEFT)
        Button(frame_serial,
               text="CONNECT",
               command=lambda: callBack.connectSerial(varcombo.get())).pack(
                   side=RIGHT, padx=10, pady=10)
    else:
        Button(frame_serial,
               text="DECONNECT",
               command=lambda: callBack.deconnectSerial()).pack(side=RIGHT,
                                                                padx=10,
                                                                pady=10)
    p.add(frame_serial)

    if callBack.connect:
        led_label = Label(frame_led, text="LED").pack(side=LEFT,
                                                      padx=10,
                                                      pady=10)
        led_bouton_red = Button(frame_led, text="RED",
                                command=callBack.ledRed).pack(side=LEFT,
                                                              padx=10,
                                                              pady=10)
        led_bouton_green = Button(frame_led,
                                  text="GREEN",
                                  command=callBack.ledGreen).pack(side=LEFT,
                                                                  padx=10,
                                                                  pady=10)
        led_bouton_off = Button(frame_led, text="OFF",
                                command=callBack.ledOff).pack(side=LEFT,
                                                              padx=10,
                                                              pady=10)

        Label(frame_alarme, text="ALARME").pack(side=LEFT, padx=10, pady=10)
        Button(frame_alarme, text="ON",
               command=callBack.alarmeON).pack(side=LEFT, padx=10, pady=10)
        Button(frame_alarme, text="OFF",
               command=callBack.alarmeOFF).pack(side=LEFT, padx=10, pady=10)

        valueLigne1 = StringVar()
        valueLigne1.set("txt_LCD_L1")
        entreeLigne1 = Entry(frame_LCD1, textvariable=valueLigne1, width=30)
        entreeLigne1.pack(side=LEFT)
        Button(
            frame_LCD1,
            text="Print on LCD L1",
            command=lambda: callBack.printOnLcd(1, entreeLigne1.get())).pack(
                side=RIGHT, padx=10, pady=10)

        valueLigne2 = StringVar()
        valueLigne2.set("txt_LCD_L2")
        entreeLigne2 = Entry(frame_LCD2, textvariable=valueLigne2, width=30)
        entreeLigne2.pack(side=LEFT)
        Button(
            frame_LCD2,
            text="Print on LCD L2",
            command=lambda: callBack.printOnLcd(2, entreeLigne2.get())).pack(
                side=RIGHT, padx=10, pady=10)

        Button(frame_singleAction, text="BIP",
               command=callBack.bip).pack(side=LEFT, padx=10, pady=10)
        Button(frame_singleAction, text="BOUM",
               command=callBack.boum).pack(side=LEFT, padx=10, pady=10)

        Label(frame_input, text="Keyboard :").pack(side=LEFT, padx=10, pady=10)
        valueKeyboard = StringVar()
        valueKeyboard.set('')
        callBack.keyboardScreen = valueKeyboard
        Entry(frame_input, textvariable=valueKeyboard,
              width=10).pack(side=LEFT, padx=10, pady=10)

        Label(frame_input, text="Button :").pack(side=LEFT, padx=10, pady=10)
        valueButton = StringVar()
        valueButton.set('')
        callBack.buttonScreen = valueButton
        Entry(frame_input, textvariable=valueButton, width=10).pack(side=LEFT,
                                                                    padx=10,
                                                                    pady=10)

        Label(frame_input, text="Capteur :").pack(side=LEFT, padx=10, pady=10)
        secousseValue = DoubleVar()
        callBack.secousseScreen = secousseValue
        scale = Scale(frame_input, variable=secousseValue)
        scale.pack(side=LEFT, padx=10, pady=10)

        Button(fenetre, text="Fermer", command=callBack.fermer).pack(side=LEFT,
                                                                     padx=10,
                                                                     pady=10)

        p.add(frame_led)
        p.add(frame_alarme)
        p.add(frame_LCD1)
        p.add(frame_LCD2)
        p.add(frame_singleAction)
        p.add(frame_input)

    p.pack()

    return fenetre
コード例 #24
0
 def __init__(self, widget, captureManager):
     self.captureManager = captureManager
     self.sourcesList = []
     self.prevSelectedSourceIndex = -1
     self.prevSelectedMediaTypeIndex = -1
     self.prevSelectedEncoderIndex = -1
     self.streamdescriptor = -1
     self.prevSelectedEncoderModeIndex = -1
     self.prevSelectedOutputContainerTypeIndex = -1
     self.sourceComboBox = Tix.ComboBox(widget,
                                        label="Source: ",
                                        command=self.selectSource)
     self.sourceComboBox.pack(side=Tix.TOP, fill=Tix.X)
     self.sourceControl = self.captureManager.createSourceControl()
     self.sinkControl = self.captureManager.createSinkControl()
     self.encoderControl = self.captureManager.createEncoderControl()
     self.sessionControl = self.captureManager.createSessionControl()
     self.session = None
     self.encoderCLSIDList = []
     self.selectedEncoderCLSID = -1
     selfSources = ElementTree.fromstring(
         self.sourceControl.getCollectionOfSources())
     self.sources = ElementPath.findall(selfSources, "Source")
     for source in self.sources:
         friendlyname = ''
         for attributes in ElementPath.findall(source, "Source.Attributes"):
             for attribute in ElementPath.findall(attributes, "Attribute"):
                 if (attribute.get('Name') ==
                         'MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME'):
                     friendlyname = attribute.find('SingleValue').get(
                         'Value')
         self.sourceComboBox.insert(Tix.END, friendlyname)
         self.sourcesList.append(source)
     self.mediaTypeComboBox = Tix.ComboBox(widget,
                                           label="MediaType: ",
                                           state='disabled',
                                           command=self.selectMediaType)
     self.mediaTypeComboBox.pack(side=Tix.TOP, fill=Tix.X)
     self.encoderComboBox = Tix.ComboBox(widget,
                                         label="Encoder: ",
                                         state='disabled',
                                         command=self.selectEncoder)
     self.encoderComboBox.pack(side=Tix.TOP, fill=Tix.X)
     self.encoderModeComboBox = Tix.ComboBox(widget,
                                             label="EncoderMode: ",
                                             state='disabled',
                                             command=self.selectEncoderMode)
     self.encoderModeComboBox.pack(side=Tix.TOP, fill=Tix.X)
     self.encoderOutputMediaTypeComboBox = Tix.ComboBox(
         widget,
         label="EncoderOutputMediaType: ",
         state='disabled',
         command=self.selectEncoderOutputMediaType)
     self.encoderOutputMediaTypeComboBox.pack(side=Tix.TOP, fill=Tix.X)
     self.outputSinkTypeComboBox = Tix.ComboBox(
         widget,
         label="OutputSinkType: ",
         state='disabled',
         command=self.selectOutputSinkType)
     self.outputSinkTypeComboBox.pack(side=Tix.TOP, fill=Tix.X)
     self.outputContainerTypeComboBox = Tix.ComboBox(
         widget,
         label="OutputContainerType: ",
         state='disabled',
         command=self.selectOutputContainerType)
     self.outputContainerTypeComboBox.pack(side=Tix.TOP, fill=Tix.X)
     self.optionsBtn = Tkinter.Button(widget,
                                      text='Options',
                                      state='disabled',
                                      command=self.showOptions)
     self.optionsBtn.pack(side=Tix.TOP, fill=Tix.X)
     self.sessionBtn = Tkinter.Button(widget,
                                      text='Session',
                                      state='disabled',
                                      command=self.initSession)
     self.sessionBtn.pack(side=Tix.TOP, fill=Tix.X)
コード例 #25
0
ファイル: main_window.py プロジェクト: waternk/HecHms
    def __init__(self,
                 parent,
                 functions,
                 first=None,
                 restore=True,
                 width=100,
                 raise_exception=False,
                 overwrite=None,
                 hide=False):
        """
        constructor
        @param      parent          window parent
        @param      functions       dictionary with a list of functions { name: function }
        @param      first           first function to select
        @param      restore         if True, check if existing saved parameters are present
        @param      width           number of characters in every Entry field
        @param      raise_exception raise an exception instead of catching it
        @param      overwrite       parameters to overwrite
        @param      hide            if True, hide the window after clicking on OK
        """
        if overwrite is None:
            overwrite = {}
        tkinter.Frame.__init__(self, parent)
        self.kparent = parent
        self.fsel = tkinter.Frame(self)
        self.ffun = tkinter.Frame(self)
        hline = tkinter.Frame(self, height=10, width=800, bg="blue")
        self.fsel.pack()
        hline.pack()
        self.ffun.pack()
        self.parent = parent

        self.varcombo = tix.StringVar()
        self.combo = tix.ComboBox(
            self.fsel,
            editable=1,
            dropdown=1,
            variable=self.varcombo,
            command=self.change_selection,
            options="listbox.height %d label.width %d entry.width %d" %
            (25, 30, 50))
        # put the text zone in read only mode
        self.combo.entry.config(state='readonly')
        for i, k in enumerate(sorted(functions)):
            self.combo.insert(i, k)
        self.combo.pack()
        self.functionsDict = functions

        if first is None:
            keys = sorted(functions.keys())
            first = keys[0]
        firstFunction = functions[first]

        self.params = {
            "restore": restore,
            "width": width,
            "raise_exception": raise_exception,
            "overwrite": overwrite,
            "hide": hide
        }

        self.varcombo.set(first)
        self.change_frame_function(firstFunction)
コード例 #26
0
    def __init__(self, rootWindow=None, options={}):

        self.lastTitle = None
        if (rootWindow is None): rootWindow = Tkinter.Toplevel()
        self.rootWindow = rootWindow
        Tkinter.Frame.__init__(self, rootWindow)
        self.options = {}
        for option in Options:
            self.options[option] = Options[option]
        for option in options:
            if (option in ['xMin', 'xMax', 'yMin', 'yMax']):
                self.options[option] = options[option]
            elif (option in ['xLabel', 'yLabel', 'title']):
                if (type(options[option]) != type('')):
                    raise Exception('option %s value must be a string')
                self.options[option] = options[option]
            elif (option in ['xlog', 'ylog']):
                self.options[option] = 0
                if (options[option]): self.options[option] = 1
            else:
                raise Exception('Unsupported option = %s' % options)

        menubar = Tkinter.Menu(rootWindow)
        self.frame = Tkinter.LabelFrame(self, text="Plot Options")
        self.frame.grid(row=0, sticky=Tkinter.W + Tkinter.E)
        self.frame.grid()
        plotItemsFrame = Tkinter.Frame(self)
        plotItemsFrame.grid(row=1, sticky=Tkinter.W + Tkinter.E)
        self.grid()
        self.savedTitle = rootWindow.title()

        self.plotItemEditting = fudgeNdMultiPlotMisc.fudgeNdMultiPlotItemsDialog(
            plotItemsFrame, self.redraw, activeMenubar=menubar)
        self.g = Gnuplot.Gnuplot()
        self.g('set ticslevel 0.')

        optionsMenu = Tkinter.Menu(menubar, tearoff=0)
        self.legendOnVar = Tkinter.IntVar()
        optionsMenu.add_checkbutton(label="Legend",
                                    variable=self.legendOnVar,
                                    command=self.legendCallback)
        menubar.insert_cascade(0, label="Options", menu=optionsMenu)

        dataMenu = Tkinter.Menu(menubar, tearoff=0)
        dataMenu.add_command(label="Read file", command=self.readFile)
        menubar.insert_cascade(0, label="Data", menu=dataMenu)

        fileMenu = Tkinter.Menu(menubar, tearoff=0)

        savePlotAs = Tkinter.Menu(fileMenu, tearoff=0)
        savePlotAs.add_command(label="pdf", command=self.plotSaveAsPDF)
        savePlotAs.add_command(label="png", command=self.plotSaveAsPNG)
        savePlotAs.add_command(label="svg", command=self.plotSaveAsSVG)
        savePlotAs.add_command(label="eps", command=self.plotSaveAsEps)
        fileMenu.add_cascade(label="Save plot as", menu=savePlotAs)

        fileMenu.add_command(label="Print", command=self.plotPrint)
        fileMenu.add_separator()
        fileMenu.add_command(label="Exit", command=rootWindow.quit)
        menubar.insert_cascade(0, label="File", menu=fileMenu)
        rootWindow.config(menu=menubar)

        def entry_Callback(self, e):
            """Called whenever the <Return> key is pressed in certain entry window."""
            self.replot()

        Row = 0
        if (not gnuplot_old):
            fontWidthLabel = Tkinter.Label(self.frame, text="font size = ")
            fontWidthLabel.grid(row=Row, column=0, sticky=Tkinter.E)
            self.fontSizeVar = Tkinter.IntVar()
            self.fontSizeVar.set(12)
            fontSizeEntry = Tkinter.Entry(self.frame,
                                          textvariable=self.fontSizeVar)
            fontSizeEntry.grid(row=Row, column=1, sticky=Tkinter.W + Tkinter.E)
            fontSizeEntry.bind("<Return>",
                               lambda e, self=self: entry_Callback(self, e))
            self.legendBoxVar = Tkinter.IntVar()
            self.legendBoxVar.set(0)
            b = logButton(self, "Legend box", Row, 2, self.legendBoxVar)
            Row += 1
        ticsSize = Tkinter.Label(self.frame, text="tics size = ")
        ticsSize.grid(row=Row, column=0, sticky=Tkinter.E)
        self.ticsVar = Tkinter.DoubleVar()
        self.ticsVar.set(1.5)
        ticsSizeEntry = Tkinter.Entry(self.frame, textvariable=self.ticsVar)
        ticsSizeEntry.grid(row=Row, column=1, sticky=Tkinter.W + Tkinter.E)
        ticsSizeEntry.bind("<Return>",
                           lambda e, self=self: entry_Callback(self, e))

        Row += 1
        l = Tkinter.Label(self.frame, text="legend x,y =")
        l.grid(row=Row, column=0, sticky=Tkinter.E)
        self.legendX = Tkinter.DoubleVar()
        self.legendX.set(.98)
        e = Tkinter.Entry(self.frame, textvariable=self.legendX)
        e.grid(row=Row, column=1, sticky=Tkinter.W + Tkinter.E)
        e.bind("<Return>", lambda e, self=self: entry_Callback(self, e))
        self.legendY = Tkinter.DoubleVar()
        self.legendY.set(.95)
        e = Tkinter.Entry(self.frame, textvariable=self.legendY)
        e.grid(row=Row, column=2, sticky=Tkinter.W + Tkinter.E)
        e.bind("<Return>", lambda e, self=self: entry_Callback(self, e))

        Row += 1
        xAxisLabel = Tkinter.Label(self.frame, text="x label = ")
        xAxisLabel.grid(row=Row, column=0, sticky=Tkinter.E)
        self.xAxisVar = Tkinter.StringVar()
        self.xAxisVar.set(self.options["xLabel"])
        xAxisEntry = Tkinter.Entry(self.frame, textvariable=self.xAxisVar)
        xAxisEntry.grid(row=Row,
                        column=1,
                        columnspan=3,
                        sticky=Tkinter.W + Tkinter.E)
        xAxisEntry.bind("<Return>",
                        lambda e, self=self: entry_Callback(self, e))

        Row += 1
        yAxisLabel = Tkinter.Label(self.frame, text="y label = ")
        yAxisLabel.grid(row=Row, column=0, sticky=Tkinter.E)
        self.yAxisVar = Tkinter.StringVar()
        self.yAxisVar.set(self.options["yLabel"])
        yAxisEntry = Tkinter.Entry(self.frame, textvariable=self.yAxisVar)
        yAxisEntry.grid(row=Row,
                        column=1,
                        columnspan=3,
                        sticky=Tkinter.W + Tkinter.E)
        yAxisEntry.bind("<Return>",
                        lambda e, self=self: entry_Callback(self, e))

        Row += 1
        TitleLabel = Tkinter.Label(self.frame, text="title = ")
        TitleLabel.grid(row=Row, column=0, sticky=Tkinter.E)
        self.TitleVar = Tkinter.StringVar()
        self.TitleVar.set(self.options["title"])
        TitleEntry = Tkinter.Entry(self.frame, textvariable=self.TitleVar)
        TitleEntry.grid(row=Row,
                        column=1,
                        columnspan=3,
                        sticky=Tkinter.W + Tkinter.E)
        TitleEntry.bind("<Return>",
                        lambda e, self=self: entry_Callback(self, e))

        Row += 1
        xlabel = Tkinter.Label(self.frame, text="xrange")
        xlabel.grid(row=Row, column=0, columnspan=1, sticky=Tkinter.E, pady=4)

        def xrange_Callback(self, e):
            """Called when the <Return> key is pressed in the xrange entry window."""
            s = "set xrange [ %s ] noreverse" % self.xrange.get()
            self.replot(s)

        self.xrange = Tkinter.Entry(self.frame)
        RangeStr = "%s : %s" % (self.options["xMin"], self.options["xMax"])
        self.g("set xrange [ %s ] noreverse" % RangeStr)
        self.xrange.insert(0, RangeStr)
        self.xrange.grid(row=Row,
                         column=1,
                         columnspan=2,
                         sticky=Tkinter.W + Tkinter.E)
        self.xrange.bind("<Return>",
                         lambda e, self=self: xrange_Callback(self, e))
        self.xlogVar = Tkinter.IntVar()
        self.xlogVar.set(self.options['xlog'])
        xLogButton = logButton(self, "xlog", Row, 3, self.xlogVar)

        Row += 1
        ylabel = Tkinter.Label(self.frame, text="yrange")
        ylabel.grid(row=Row, column=0, columnspan=1, sticky=Tkinter.E, pady=4)

        def yrange_Callback(self, e):
            """Called when the <Return> key is pressed in the yrange entry window."""
            s = "set yrange [ %s ] noreverse" % self.yrange.get()
            self.replot(s)

        self.yrange = Tkinter.Entry(self.frame)
        RangeStr = "%s : %s" % (self.options["yMin"], self.options["yMax"])
        self.g("set yrange [ %s ] noreverse" % RangeStr)
        self.yrange.insert(0, RangeStr)
        self.yrange.grid(row=Row,
                         column=1,
                         columnspan=2,
                         sticky=Tkinter.W + Tkinter.E)
        self.yrange.bind("<Return>",
                         lambda e, self=self: yrange_Callback(self, e))
        self.ylogVar = Tkinter.IntVar()
        self.ylogVar.set(self.options['ylog'])
        yLogButton = logButton(self, "ylog", Row, 3, self.ylogVar)

        try:

            def gnuplotCommand_Callback2(self, e):
                """Called when the <Return> key is pressed in the gnuplotCommand entry window."""
                self.replot(self.gnuplotCommandComboBoxVar.get())

            Row += 1
            self.gnuplotCommandComboBox = Tix.ComboBox(self.frame)
            self.gnuplotCommandComboBox.grid(row=Row,
                                             column=0,
                                             columnspan=4,
                                             sticky=Tkinter.W + Tkinter.E)
            self.gnuplotCommandComboBox['editable'] = True
            self.gnuplotCommandComboBox['prunehistory'] = False
            self.gnuplotCommandComboBox['label'] = 'Plot command'
            self.gnuplotCommandComboBox['selectmode'] = 'browse'
            self.gnuplotCommandComboBox[
                'command'] = lambda e, self=self: gnuplotCommand_Callback2(
                    self, e)
            self.gnuplotCommandComboBoxVar = Tkinter.StringVar()
            self.gnuplotCommandComboBox[
                'variable'] = self.gnuplotCommandComboBoxVar
            self.gnuplotCommandComboBox['history'] = True
            self.gnuplotCommandComboBox['state'] = 'normal'
            self.gnuplotCommandComboBox.entry['state'] = 'normal'
        except TclError:
            pass
コード例 #27
0
	def __init__(self, master, thread_ = False):
		Frame.__init__(self, master)
		self.master = master
		self.master.title('D R O N E')
		self.pack()
		self.csound = csnd6.CppSound()
		#self.csound.setPythonMessageCallback()
		self.playing = False
		self.thread_ = thread_

		self.configuration = Configuration()

		r = 0
		c = 0

		self.leftFrame = Frame(self)
		self.leftFrame.grid(row=r, column=c, sticky=N+E+W, padx=4, pady=4)

		self.harmonicsFrame = Frame(
		self.leftFrame,
		bd = 2,
		relief = 'groove'
		)
		self.harmonicsFrame.grid(row=r, column=c, sticky=N+E+W+S, padx=4, pady=4)

		self.harmonicsLabel = Label(
		self.harmonicsFrame,
		text = 'Oscillator harmonic content'
		)
		self.harmonicsLabel.grid(row=r, column=c, sticky=N+E+W+S)
		r = r + 1

		self.gkHarmonicTableFactor = Scale(
		self.harmonicsFrame,
		from_ = 0.0,
		to = 2.0,
		resolution = 0.001,
		length = 250,
		orient = HORIZONTAL,
		label = 'Wavetable harmonics multiplier',
		command = self.on_gkHarmonicTableFactor
		)
		self.gkHarmonicTableFactor.grid(row=r, column=c, sticky=E+W)
		r = r + 1

		self.distortFrame = Frame(
		self.leftFrame,
		bd = 2,
		relief = 'groove'
		)
		self.distortFrame.grid(row=r, column=c, sticky=N+E+W+S, padx=4, pady=4)

		self.distortLabel = Label(
		self.distortFrame,
		text = 'Waveshaping distortion'
		)
		self.distortLabel.grid(row=r, column=c, sticky=N+E+W+S)
		r = r + 1

		self.gkDistortTableFactor = Scale(
		self.distortFrame,
		from_ = 0.0,
		to = 10.0,
		resolution = 0.001,
		length = 250,
		orient = HORIZONTAL,
		label = 'Distortion table multiplier',
		command = self.on_gkDistortTableFactor
		)
		self.gkDistortTableFactor.grid(row=r, column=c, sticky=E+W)
		r = r + 1

		self.gkDistortFactor = Scale(
		self.distortFrame,
		from_ = 0.0,
		to = 1.0,
		resolution = 0.001,
		length = 250,
		orient = HORIZONTAL,
		label = 'Distortion gain',
		command = self.on_gkDistortFactor
		)
		self.gkDistortFactor.grid(row=r, column=c, sticky=E+W)
		r = r + 1

		r = 0
		c = 1

		self.rightFrame = Frame(self)
		self.rightFrame.grid(row=r, column=c, sticky=N+E+W, padx=4, pady=4)

		self.reverbFrame = Frame(
		self.rightFrame,
		bd = 2,
		relief = 'groove'
		)
		self.reverbFrame.grid(row=r, column=c, sticky=N+E+W, padx=4, pady=4)

		self.reverbLabel = Label(
		self.reverbFrame,
		text = 'Reverbsc'
		)
		self.reverbLabel.grid(row=r, column=c, sticky=E+W)
		r = r + 1

		self.gkReverbscFeedback = Scale(
		self.reverbFrame,
		from_ = 0.0,
		to = 0.9999,
		resolution = 0.001,
		length = 250,
		orient = HORIZONTAL,
		label = 'Feedback (reverberation time)',
		command = self.on_gkReverbscFeedback
		)
		self.gkReverbscFeedback.grid(row=r, column=c, sticky=E+W)
		r = r + 1

		self.FactorFrame = Frame(
		self.rightFrame,
		bd = 2,
		relief = 'groove'
		)
		self.FactorFrame.grid(row=r, column=c, sticky=N+E+W, padx=4, pady=4)

		self.FactorLabel = Label(
		self.FactorFrame,
		text = 'Master gain'
		)
		self.FactorLabel.grid(row=r, column=c, sticky=E+W)
		r = r + 1

		self.gkMasterLevel = Scale(
		self.FactorFrame,
		from_ = 0.0,
		to = 2.0,
		resolution = 0.001,
		length = 250,
		orient = HORIZONTAL,
		label = 'Level',
		command = self.on_gkMasterLevel
		)
		self.gkMasterLevel.grid(row=r, column=c, sticky=E+W)
		r = r + 1

		self.scoreTimeFrame = Frame(
		self.rightFrame,
		bd = 2,
		relief = 'groove'
		)
		self.scoreTimeFrame.grid(row=r, column=c, sticky=N+E+W+S, padx=4, pady=4)

		self.scoreTimeLabel = Label(
		self.scoreTimeFrame,
		text = 'Score time'
		)
		self.scoreTimeLabel.grid(row=r, column=c, sticky=N+E+W+S)
		r = r + 1

		self.scoreTimeDoubleVar = DoubleVar()
		self.scoreTimeEntry = Entry(
		self.scoreTimeFrame,
		width = 40,
		textvariable = self.scoreTimeDoubleVar
		)
		self.scoreTimeEntry.grid(row=r, column=c, sticky=N+E+W+S)
		r = r + 1

		self.outputFrame = Frame(
		self.rightFrame,
		bd = 2,
		relief = 'groove'
		)
		self.outputFrame.grid(row=r, column=c, sticky=N+E+W+S, padx=4, pady=4)

		self.outputLabel = Label(
		self.outputFrame,
		text = 'Output'
		)
		self.outputLabel.grid(row=r, column=c, sticky=N+E+W+S)
		r = r + 1

		self.outputStringVar = StringVar()
		self.output = Tix.ComboBox(
		self.outputFrame,
		listwidth = 80,
		)
		self.output.grid(row=r, column=c, sticky=N+E+W+S, padx=4, pady=4)
		choices = csoundCommands.keys()
		choices.sort()
		index = 0
		for choice in choices:
			self.output.insert(index, choice)
			index = index + 1
		self.output.pick(0)
		r = r + 1

		self.loadButton = Button(
		self.rightFrame,
		text = 'Load',
		command = self.on_load
		)
		self.loadButton.grid(row=r, column=c, sticky=N+E+W+S, padx=4, pady=4)
		r = r + 1

		self.saveButton = Button(
		self.rightFrame,
		text = 'Save',
		command = self.on_save
		)
		self.saveButton.grid(row=r, column=c, sticky=N+E+W+S, padx=4, pady=4)
		r = r + 1

		self.playButton = Button(
		self.rightFrame,
		text = 'Play',
		command = self.on_play
		)
		self.playButton.grid(row=r, column=c, sticky=N+E+W+S, padx=4, pady=4)
		r = r + 1

		self.configure()
コード例 #28
0
fenetre.title("Member Administrator")

#Construction de la fenetre
fd = open("ressources/users.bdd", 'r')
i = 0
lignes  = fd.readlines()
for line in lignes:
	line = line.rstrip().split(";")
	name = StringVar()
	name.set(line[0])
	job = StringVar()
	job.set(line[2])
	password = line[1]
	entreeName = Entry(fenetre, textvariable = name, width = 30)
	entreeName.grid(row = i, column = 0)
	listWork = Tix.ComboBox(fenetre, variable = job)
	listWork.grid(row = i, column = 1)
	listWork.insert(0, 'admin')
	listWork.insert(1, 'medecin')
	listWork.insert(2, 'infirmiere')
	names.append(name)
	jobs.append(job)
	passwords.append(password)
	entreesNames.append(entreeName)
	listJobs.append(listWork)
	line = fd.read()
	i = i + 1
fd.close()

bouton = Button(fenetre, text = "Mettre à jour la liste", command = MAJListe)
bouton.grid(row = i)
コード例 #29
0
    def __init__(self, genitore):
        #--- costanti per il controllo della disposizione
        #--- dei pulsanti
        # impostazione delle variabili di controllo Tkinter,
        # controllate dai pulsanti radio
        self._Element = StringVar()
        self._Edgecombo = Tix.StringVar()
        self._Energy = StringVar()
        self._Gamma = StringVar()
        self._afterE = StringVar()
        self._kafterE = StringVar()
        self._beforeE = StringVar()
        self._mEs = StringVar()
        self._mono_velocity = StringVar()
        self._Crystal = StringVar()
        self._time = StringVar()
        self._filt = StringVar()
        self._Deff = StringVar()
        self._Npoint = StringVar()

        self._Element.set("Cu")
        self._Edgecombo.set("K")
        self._Crystal.set("Si 111")
        self._Energy.set(
            tables.Edge_energy[self._Element.get()][tables.QN_Transition.index(
                self._Edgecombo.get())])
        self._Gamma.set(
            round(
                tables.getGamach(xtables.elements.index(self._Element.get()),
                                 self._Edgecombo.get()), 2))
        self._afterE.set(1600)
        self._kafterE.set(str(bt.Etok(float(self._afterE.get()), 0)))
        self._beforeE.set(150)
        self._mEs.set(.5)
        self._mono_velocity.set(10000)
        self._Npoint.set(
            (eval(self._afterE.get()) + eval(self._beforeE.get())) /
            eval(self._mEs.get()))

        #---------------
        self.mioGenitore = genitore
        #self.mioGenitore.geometry("640x400")
        ### Il quadro principale si chiama 'quadro_grande'
        self.quadro_grande = Frame(genitore)  ###
        self.quadro_grande.pack(expand=YES, fill=BOTH)
        self.quadro_controllo = Frame(self.quadro_grande)  ###
        self.quadro_controllo.pack(side=TOP,
                                   fill=BOTH,
                                   padx=10,
                                   pady=5,
                                   ipadx=5,
                                   ipady=5)

        # All'interno di 'quadro_controllo' si creano un'etichetta
        # per il titolo e un 'quadro_pulsanti'
        mioMessaggio = "POSSIBLE CORRECTION FOR EXAFS SCAN"
        Label(self.quadro_controllo, text=mioMessaggio,
              justify=LEFT).pack(side=TOP, anchor=W)

        ################################################################################################
        # 'SCAN PARAMETER'
        self.scan_parameter = LabelFrame(
            self.quadro_controllo,
            text="SCAN PARAMETER")  #,text = "Correction"
        self.scan_parameter.pack(side=TOP,
                                 expand=YES,
                                 fill=X,
                                 ipadx=3,
                                 ipady=10)
        # Si aggiungono alcuni sottoquadri a 'dspacing'

        self.scan_parameter1 = Frame(
            self.scan_parameter)  #,text = "Correction"
        self.scan_parameter1.pack(
            side=TOP, fill=X)  #expand = YES, , ipadx = 3, ipady = 10
        # Si aggiungono alcuni sottoquadri a 'dspacing'

        self.Element = LabelFrame(self.scan_parameter1, text="Element")
        self.Element.pack(side=LEFT,
                          expand=YES,
                          fill=None,
                          anchor=W,
                          pady=10,
                          ipadx=5,
                          ipady=3,
                          padx=5)
        self._entry_Element = Entry(self.Element,
                                    width=6,
                                    textvariable=self._Element)
        self._entry_Element.pack(side=LEFT, padx=10)
        self._entry_Element.bind("<Return>", self.Affiche)

        self.Edge = LabelFrame(self.scan_parameter1, text="Edge")
        self.Edge.pack(side=LEFT,
                       expand=YES,
                       fill=None,
                       anchor=W,
                       pady=10,
                       ipadx=5,
                       ipady=3,
                       padx=5)
        self.combo_Edge = Tix.ComboBox(
            self.Edge,
            editable=1,
            dropdown=1,
            variable=self._Edgecombo,
            options='listbox.height 5 listbox.width 3 entry.width 3 ',
            command=self.Affiche)

        #combo.subwidget_list['slistbox']
        #self.combo_Edge.config(state='readonly')  ## met la zone de texte en lecture seule
        self.combo_Edge.insert(0, 'K')
        self.combo_Edge.insert(1, 'L1')
        self.combo_Edge.insert(2, 'L2')
        self.combo_Edge.insert(3, 'L3')
        self.combo_Edge.pack(side=LEFT, padx=10)

        self.Crystal = LabelFrame(self.scan_parameter1, text="Mono Crystal")
        self.Crystal.pack(side=LEFT,
                          expand=YES,
                          fill=None,
                          anchor=W,
                          pady=10,
                          ipadx=5,
                          ipady=3,
                          padx=5)
        self.combo_Crystal = Tix.ComboBox(self.Crystal,
                                          editable=1,
                                          dropdown=1,
                                          variable=self._Crystal,
                                          command=self.Affiche)
        #self.combo_Edge.config(state='readonly')  ## met la zone de texte en lecture seule
        self.combo_Crystal.insert(0, 'Si 111')
        self.combo_Crystal.insert(1, 'Si 311')
        self.combo_Crystal.insert(2, 'Si 511')
        self.combo_Crystal.pack(side=LEFT, padx=10)

        self.s2 = Frame(self.scan_parameter1, width=20).pack(
            side=LEFT,
            expand=YES,
            fill=X,
            anchor=W,
        )
        ###################################################################################################

        self.scan_parameter2 = Frame(
            self.scan_parameter)  #,text = "Correction"
        self.scan_parameter2.pack(
            side=TOP, anchor=W)  #, expand = YES, ipadx = 3, ipady = 10

        self.Energy = LabelFrame(self.scan_parameter2, text="Energy")
        self.Energy.pack(side=LEFT,
                         fill=None,
                         anchor=W,
                         pady=10,
                         ipadx=5,
                         ipady=3,
                         padx=5)
        self._entry_Energy = Entry(self.Energy,
                                   width=6,
                                   textvariable=self._Energy)
        self._entry_Energy.pack(side=LEFT, padx=10)

        self.Gamma = LabelFrame(self.scan_parameter2, text="Gamma")
        self.Gamma.pack(side=LEFT,
                        fill=None,
                        anchor=W,
                        pady=10,
                        ipadx=5,
                        ipady=3,
                        padx=5)
        self._entry_Gamma = Entry(self.Gamma,
                                  width=6,
                                  textvariable=self._Gamma)
        self._entry_Gamma.pack(side=LEFT, padx=10)

        self.beforeE = LabelFrame(self.scan_parameter2, text="eV pre edge")
        self.beforeE.pack(side=LEFT,
                          expand=YES,
                          fill=None,
                          anchor=W,
                          ipadx=5,
                          ipady=3,
                          padx=5)
        self._entry_beforeE = Entry(self.beforeE,
                                    width=6,
                                    textvariable=self._beforeE)
        self._entry_beforeE.pack(side=LEFT, padx=10)
        self._entry_beforeE.bind("<Return>", self.setparam)

        self.afterE = LabelFrame(self.scan_parameter2,
                                 text="eV after the edge")
        self.afterE.pack(side=LEFT,
                         expand=YES,
                         fill=None,
                         anchor=W,
                         pady=10,
                         ipadx=5,
                         ipady=3,
                         padx=5)  #
        spacer = Frame(self.afterE).pack(side=LEFT, anchor=W, padx=3)
        self._entry_afterE = Entry(self.afterE,
                                   width=6,
                                   textvariable=self._afterE)
        self._entry_afterE.pack(side=LEFT)
        self.l_entry_afterE = Label(self.afterE, text="eV", justify=LEFT)
        self.l_entry_afterE.pack(side=LEFT,
                                 expand=NO,
                                 fill=None,
                                 anchor=W,
                                 padx=0)
        spacer = Frame(self.afterE).pack(side=LEFT, anchor=W, padx=10)
        self._entry_kafterE = Entry(self.afterE,
                                    width=6,
                                    textvariable=self._kafterE)
        self._entry_kafterE.pack(side=LEFT, padx=1)
        self.l_entry_kafterE = Label(self.afterE, text="A-1", justify=LEFT)
        self.l_entry_kafterE.pack(side=LEFT,
                                  expand=NO,
                                  fill=None,
                                  anchor=W,
                                  padx=0)
        self._entry_afterE.bind("<Return>", self.E2A)
        self._entry_kafterE.bind("<Return>", self.A2E)
        #self.s = Frame(self.scan_parameter2).pack(side = LEFT, expand = YES, fill = X)
        ###################################################################################################
        self.scan_parameter3 = LabelFrame(self.scan_parameter,
                                          text="minimum energy step")
        self.scan_parameter3.pack(side=TOP, fill=X)
        self.Eslider = Scale(self.scan_parameter3,
                             from_=.1,
                             to=3,
                             length=420,
                             command=self.setparam,
                             variable=self._mEs,
                             resolution=.1,
                             orient=HORIZONTAL)
        self.Eslider.pack(side=LEFT, fill=X, anchor=W, ipady=0)
        self.mEs = Frame(self.scan_parameter3)
        self.mEs.pack(side=LEFT,
                      expand=YES,
                      fill=BOTH,
                      anchor=W,
                      pady=0,
                      ipadx=5,
                      ipady=2,
                      padx=5)
        self._entry_mEs = Entry(self.mEs, width=6, textvariable=self._mEs)
        self._entry_mEs.pack(side=LEFT, fill=X, anchor=S, pady=2, padx=10)
        self._entry_mEs.bind("<Return>", self.setparam)
        ##################################################################################################
        self.scan_parameter4 = LabelFrame(self.scan_parameter,
                                          text="mono_velocity")
        self.scan_parameter4.pack(side=TOP, fill=X)
        self.Aslider = Scale(self.scan_parameter4,
                             from_=1,
                             to=15000,
                             length=420,
                             command=self.setparam,
                             variable=self._mono_velocity,
                             resolution=1,
                             orient=HORIZONTAL)
        self.Aslider.pack(side=LEFT, fill=X, anchor=W, ipady=0)
        self.monovelocity = Frame(self.scan_parameter4)
        self.monovelocity.pack(side=LEFT,
                               expand=YES,
                               fill=BOTH,
                               anchor=W,
                               pady=0,
                               ipadx=5,
                               ipady=2,
                               padx=5)
        self._entry_monovelocity = Entry(self.monovelocity,
                                         width=6,
                                         textvariable=self._mono_velocity)
        self._entry_monovelocity.pack(side=LEFT,
                                      fill=X,
                                      anchor=S,
                                      pady=2,
                                      padx=10)
        self._entry_mEs.bind("<Return>", self.setparam)
        ##################################################################################################
        # 'Suggested PARAMETER'
        self.sugg_parameter = LabelFrame(
            self.quadro_controllo,
            text="OBTAINED PARAMETER")  #,text = "Correction"
        self.sugg_parameter.pack(side=TOP, fill=X, ipadx=3,
                                 ipady=10)  #, expand = YES
        # Si aggiungono alcuni sottoquadri a 'dspacing'
        self.time = LabelFrame(self.sugg_parameter, text="Scan Time")
        self.time.pack(side=LEFT,
                       fill=None,
                       anchor=W,
                       pady=10,
                       ipadx=3,
                       ipady=3,
                       padx=5)  #, expand = YES
        self._entry_time = Entry(self.time, width=6, textvariable=self._time)
        self._entry_time.pack(side=LEFT, padx=10)
        self.time_s = Label(self.time, text="s",
                            justify=LEFT).pack(side=LEFT,
                                               anchor=W)  #, expand = YES

        self.filt = LabelFrame(self.sugg_parameter, text="MUSST filter")
        self.filt.pack(side=LEFT,
                       fill=None,
                       anchor=E,
                       pady=10,
                       ipadx=5,
                       ipady=3,
                       padx=5)  #, expand = YES
        self._entry_filt = Entry(self.filt, width=6, textvariable=self._filt)
        self._entry_filt.pack(side=LEFT, padx=1, expand=YES)

        self.Deff = LabelFrame(self.sugg_parameter, text="Det efficencency")
        self.Deff.pack(side=LEFT,
                       fill=None,
                       anchor=E,
                       pady=10,
                       ipadx=5,
                       ipady=3,
                       padx=5)  #, expand = YES
        self._entry_Deff = Entry(self.Deff, width=6, textvariable=self._Deff)
        self._entry_Deff.pack(side=LEFT, padx=1, expand=YES)

        self.Npoint = LabelFrame(self.sugg_parameter, text="Number of points")
        self.Npoint.pack(side=LEFT,
                         fill=None,
                         anchor=E,
                         pady=10,
                         ipadx=5,
                         ipady=3,
                         padx=5)  #, expand = YES
        self._entry_Npoint = Entry(self.Npoint,
                                   width=6,
                                   textvariable=self._Npoint)
        self._entry_Npoint.pack(side=LEFT, padx=1, expand=YES)
コード例 #30
0
    def view_memory(self):
        self.message("You are now setting memory information")
        if self.memory_once == 1:
            self.memory_ok()
            return

        top = self.skyeye_body("Cpu & Mainboard")

        mem = Tix.Frame(top)

        b = Tix.Label(mem, text="Map  :")
        map = Tix.OptionMenu(mem, command=self.memory_map)
        b.grid(row=0, column=0, padx=5, pady=3, sticky=W + E)
        map.grid(row=0, column=1, columnspan=2, padx=5, pady=3, sticky=W + E)

        b = Tix.Label(mem, text="Type :")
        type = Tix.OptionMenu(mem, command=self.memory_type)
        b.grid(row=1, column=0, padx=5, pady=3, sticky=W + E)
        type.grid(row=1, column=1, columnspan=2, padx=5, pady=3, sticky=W + E)

        b = Tix.Label(mem, text="'Addr :")
        addr = Tix.ComboBox(mem,
                            editable=1,
                            history=1,
                            anchor=Tix.E,
                            command=self.memory_addr)
        b.grid(row=2, column=0, padx=5, pady=3, sticky=W + E)
        addr.grid(row=2, column=1, columnspan=2, padx=5, pady=3, sticky=W + E)

        b = Tix.Label(mem, text="Size :")
        size = Tix.ComboBox(mem,
                            editable=1,
                            history=1,
                            anchor=Tix.E,
                            command=self.memory_size)
        b.grid(row=3, column=0, padx=5, pady=3, sticky=W + E)
        size.grid(row=3, column=1, columnspan=2, padx=5, pady=3, sticky=W + E)

        b = Tix.Label(mem, text="File :")
        file = Tix.FileEntry(mem, command=self.memory_file)
        b.grid(row=4, column=0, padx=5, pady=3, sticky=W + E)
        file.grid(row=4, column=1, columnspan=2, padx=5, pady=3, sticky=W + E)

        add = Tix.Button(top, text="Add", command=self.memory_add)
        reset = Tix.Button(top, text="Reset", command=self.memory_reset)
        ok = Tix.Button(top, text="OK", command=self.memory_ok)

        map.add_command("I", label="I")
        map.add_command("M", label="M")

        type.add_command("R", label="R")
        type.add_command("W", label="W")
        type.add_command("RW", label="RW")

        addr.insert(Tix.END, "0x00000000")

        size.insert(Tix.END, "0x00000000")

        mem.grid(row=0,
                 column=0,
                 columnspan=3,
                 padx=5,
                 pady=10,
                 sticky=N + S + W + E)
        add.grid(row=1, column=0, padx=5, pady=10, sticky=W + E)
        reset.grid(row=1, column=1, padx=5, pady=10, sticky=W + E)
        ok.grid(row=1, column=2, padx=5, pady=10, sticky=W + E)

        self.skyeye_redobody()