def body(self, master):
        Label(master, text='Select Case:').grid(row=0, sticky=W)
        Label(master, text='Select Type:').grid(row=1, sticky=W)
        Label(master, text='Enter Value:').grid(row=2, sticky=W)

        self.combo1 = Pmw.ComboBox(master,
                                   scrolledlist_items=("Upper", "Lower",
                                                       "Mixed"),
                                   entry_width=12,
                                   entry_state="disabled",
                                   selectioncommand=self.ripple)
        self.combo1.selectitem("Upper")
        self.combo1.component('entry').config(background='gray80')

        self.combo2 = Pmw.ComboBox(master,
                                   scrolledlist_items=(),
                                   entry_width=12,
                                   entry_state="disabled")
        self.combo2.component('entry').config(background='gray80')

        self.entry1 = Entry(master, width=12)

        self.combo1.grid(row=0, column=1, sticky=W)
        self.combo2.grid(row=1, column=1, sticky=W)
        self.entry1.grid(row=2, column=1, sticky=W)

        return self.combo1
Ejemplo n.º 2
0
    def Choices(self):
        self.GetBlasts()
        self.cf = Frame(self.toplevel)
        self.cf.pack(side=TOP, expand=1, fill=X)
        self.dbs = Pmw.ComboBox(self.cf,
                                label_text='Blast Databases:',
                                labelpos='nw',
                                scrolledlist_items=self.nin + self.pin,
                                selectioncommand=self.Validate)
        self.blasts = Pmw.ComboBox(self.cf,
                                   label_text='Blast Programs:',
                                   labelpos='nw',
                                   scrolledlist_items=[
                                       'blastn', 'blastp', 'blastx', 'tblastn',
                                       'tblastx'
                                   ],
                                   selectioncommand=self.Validate)
        self.dbs.pack(side=LEFT, expand=1, fill=X)
        self.blasts.pack(side=LEFT, expand=1, fill=X)

        self.alternative_f = Frame(self.cf)
        self.alternative = Entry(self.alternative_f)
        self.alternative_f.pack(side=TOP, fill=X, expand=1)
        self.alternative.pack(side=LEFT, fill=X, expand=1)
        self.ok = Button(self.alternative_f, text='Run', command=self._Run)
        self.ok.pack(side=RIGHT)

        self.dbs.selectitem(0)
        self.blasts.selectitem(0)
        self.Validate()
Ejemplo n.º 3
0
    def __init__(self, parent):
        frame = tkinter.Frame(parent)
        frame.pack(fill='both', expand=1)

        defaultPalette = Pmw.Color.getdefaultpalette(parent)

        colors = ('red', 'green', 'blue')
        items = ('Testing', 'More testing', 'a test', 'foo', 'blah')
        for count in range(len(colors)):
            color = colors[count]
            normalcolor = Pmw.Color.changebrightness(parent, color, 0.85)
            Pmw.Color.setscheme(parent, normalcolor)
            combo = Pmw.ComboBox(frame,
                                 scrolledlist_items=items,
                                 entryfield_value=items[0])
            combo.grid(sticky='nsew', row=count, column=0)

            normalcolor = Pmw.Color.changebrightness(parent, color, 0.35)
            Pmw.Color.setscheme(parent, normalcolor, foreground='white')
            combo = Pmw.ComboBox(frame,
                                 scrolledlist_items=items,
                                 entryfield_value=items[0])
            combo.grid(sticky='nsew', row=count, column=1)

        Pmw.Color.setscheme(*(parent, ), **defaultPalette)
Ejemplo n.º 4
0
    def __init__(self, parent):
        self.parent = parent

        header = tkinter.Label(parent, text = 'Select some Tk option ' +
                'database values from\nthe lists, then click ' +
                '\'Create dialog\' to create\na MessageDialog with ' +
                'these values as defaults.')
        header.pack(padx = 10, pady = 10)

        # Create and pack the ComboBoxes to select options.
        buttons = (
            "('OK',)",
            "('Read', 'Write')",
            "('OK', 'Cancel')",
            "('OK', 'Apply', 'Cancel', 'Help')",
        )

        if tkinter.TkVersion >= 8.4:
            disabledState = 'readonly'
        else:
            disabledState = 'disabled'

        self._buttons = Pmw.ComboBox(parent, label_text = 'buttons:',
                labelpos = 'w',
                entry_state = disabledState,
                scrolledlist_items = buttons)
        self._buttons.pack(fill = 'x', expand = 1, padx = 8, pady = 8)
        self._buttons.selectitem(3)

        buttonboxpos = ('n', 's', 'e', 'w',)
        self._buttonboxpos = Pmw.ComboBox(parent, label_text = 'buttonboxpos:',
                labelpos = 'w',
                entry_state = disabledState,
                scrolledlist_items = buttonboxpos)
        self._buttonboxpos.pack(fill = 'x', expand = 1, padx = 8, pady = 8)
        self._buttonboxpos.selectitem(2)

        pad = ('0', '8', '20', '50',)
        self._pad = Pmw.ComboBox(parent, label_text = 'padx, pady:',
                labelpos = 'w',
                entry_state = disabledState,
                scrolledlist_items = pad)
        self._pad.pack(fill = 'x', expand = 1, padx = 8, pady = 8)
        self._pad.selectitem(1)

        Pmw.alignlabels((self._buttons, self._buttonboxpos, self._pad))

        # Create button to launch the dialog.
        w = tkinter.Button(parent, text = 'Create dialog',
                command = self._createDialog)
        w.pack(padx = 8, pady = 8)

        self.dialog = None
Ejemplo n.º 5
0
    def __init__(self, parent):
        parent.configure(background='white')

        # Create and pack the widget to be configured.
        self.target = Tkinter.Label(
            parent,
            relief='sunken',
            padx=20,
            pady=20,
        )
        self.target.pack(fill='x', padx=8, pady=8)

        # Create and pack the simple ComboBox.
        words = ('Monti', 'Python', 'ik', 'den', 'Holie', 'Grailen', '(Bok)')
        simple = Pmw.ComboBox(
            parent,
            label_text='Simple ComboBox:',
            labelpos='nw',
            selectioncommand=self.changeText,
            scrolledlist_items=words,
            dropdown=0,
        )
        simple.pack(side='left', fill='both', expand=1, padx=8, pady=8)

        # Display the first text.
        first = words[0]
        simple.selectitem(first)
        self.changeText(first)

        # Create and pack the dropdown ComboBox.
        colours = ('cornsilk1', 'snow1', 'seashell1', 'antiquewhite1',
                   'bisque1', 'peachpuff1', 'navajowhite1', 'lemonchiffon1',
                   'ivory1', 'honeydew1', 'lavenderblush1', 'mistyrose1')
        dropdown = Pmw.ComboBox(
            parent,
            label_text='Dropdown ComboBox:',
            labelpos='nw',
            selectioncommand=self.changeColour,
            scrolledlist_items=colours,
        )
        dropdown.pack(side='left',
                      anchor='n',
                      fill='x',
                      expand=1,
                      padx=8,
                      pady=8)

        # Display the first colour.
        first = colours[0]
        dropdown.selectitem(first)
        self.changeColour(first)
Ejemplo n.º 6
0
    def configure_notepad(self): # FONTS AND COLOR SETTINGS
        self.fontname = ('Arial','Times','Candara','Broadway','Elephant','Forte','Gabriola','Impact','Jokerman')
        self.fontstyle = ('bold','normal','italic','roman',"underline","noline","overstrike","unstrike")
        self.toplvl = Toplevel(self.master,relief=GROOVE,background='red')
        self.toplvl.attributes('-toolwindow',1)
        self.toplvl.title('Fonts and Colors')
        self.toplvl.geometry('+470+200')

        self.frame_top = ttk.Frame(self.toplvl,relief=RAISED,borderwidth=2)
        self.frame_top.pack(fill=BOTH,expand=True)

        self.groupfont = Pmw.Group(self.frame_top,tag_text='Fonts Format')
        self.groupfont.pack(fill=BOTH,expand=True,padx=5,pady=8)
        self.fontname = Pmw.ComboBox(self.groupfont.interior(),labelpos=NW,label_text='Fonts:',listbox_height=5,
                                           selectioncommand=self.effect_fontfamily,dropdown=False,
                                           scrolledlist_items=sorted(self.fontname))
        self.fontname.pack(side=LEFT,padx=5,pady=5)
        self.fontstyle= Pmw.ComboBox(self.groupfont.interior(), labelpos=NW, label_text='Font style:', listbox_height=5,
                                     selectioncommand=self.effect_fontstyle, dropdown=False,
                                     scrolledlist_items=self.fontstyle)
        self.fontstyle.pack(side=LEFT,padx=5,pady=5)
        self.fontsize = Pmw.ComboBox(self.groupfont.interior(), labelpos=NW, label_text='Fontsize:', listbox_height=5,
                                     selectioncommand=self.effect_fontsize, dropdown=False,listbox_width=1,
                                     scrolledlist_items=list(i for i in range(8,73)))
        self.fontsize.pack(side=LEFT,padx=5,pady=5)
        # COLOR CONFIGURATION
        self.groupcolor = LabelFrame(self.frame_top,text='Color Format')
        self.groupcolor.pack(fill=Y,expand=True,padx=3,pady=5,side=LEFT)
        self.colornames = ('black','white','red','green','blue','orange','pink','purple','light blue','grey')
        self.color = Pmw.ComboBox(self.groupcolor, labelpos=NW, label_text='Color:', listbox_height=5,
                                     selectioncommand=self.effect_color, dropdown=False,label_takefocus=True,
                                     scrolledlist_items=self.colornames)
        self.color.pack(anchor=W,padx=5, pady=5)
        #CLICK THIS LABEL TO GET MORE COLOR TO CHOOSE FROM
        self.more_colors = Label(self.groupcolor,text='Choose More Color',font='times 9 underline',foreground='royalblue',cursor='mouse')
        self.more_colors.bind("<Button-1>",self.choose_color)
        self.more_colors.pack(anchor=W)
        self.canvas = Canvas(self.groupcolor)
        # SETTINGS PREVIEW THAT SHOWS HOW YOUR FONTS AND COLORS WILL APPEAR IN THE TEXT WIDGET
        self.labelframe = LabelFrame(self.frame_top,text='Sample Preview',labelanchor=NW,width=250,height=50)
        self.labelframe.pack_propagate(0)
        self.labelframe.pack(side=LEFT,fill=BOTH,expand=True,pady=5,padx=5)

        self.lbl = ttk.Label(self.labelframe,text='Vicolas',justify=CENTER)
        self.lbl.pack(fill=Y,expand=True)
        # THE EXIT AND EXECUTE BUTTON BELLOW
        self.frame_bottom = ttk.Frame(self.toplvl,relief=RAISED,borderwidth=2)
        self.frame_bottom.pack(fill=BOTH,expand=True)
        self.btn = ttk.Button(self.frame_bottom,text='OK',command=self.toplvl.destroy)
        self.btn.pack(side=RIGHT,padx=5,pady=3)
Ejemplo n.º 7
0
    def __init__(self, parent):
        if not Pmw.Blt.haveblt(parent):
            message = 'Sorry\nThe BLT package has not been\n' + \
                    'installed on this system.\n' + \
                    'Please install it and try again.'
            w = tkinter.Label(parent, text=message)
            w.pack(padx=8, pady=8)
            return

        message = 'This is a simple demonstration of the\n' + \
                'BLT graph widget.\n' + \
                'Select the number of points to display and\n' + \
                'click on the button to display the graph.'
        w = tkinter.Label(parent, text=message)
        w.pack(padx=8, pady=8)

        # Create combobox to select number of points to display.
        self.combo = Pmw.ComboBox(parent,
                                  scrolledlist_items=('10', '25', '50', '100',
                                                      '300'),
                                  entryfield_value='10')
        self.combo.pack(padx=8, pady=8)

        # Create button to start blt graph.
        start = tkinter.Button(parent,
                               text='Show BLT graph',
                               command=Pmw.busycallback(self.showGraphDemo))
        start.pack(padx=8, pady=8)

        self.parent = parent
Ejemplo n.º 8
0
    def __init__(self, master=None, terminal=None):
        Frame.__init__(self, master, width="1in")

        self.terminal = terminal
        self.app = terminal.app
        self.bframe = Frame(self)

        #reset button
        self.reset_button = Button(self.bframe,
                                   text="Reset",
                                   command=self.terminal.reset)
        self.reset_button.pack(side="left", fill="x", expand="yes")

        #close button
        self.close_button = Button(self.bframe,
                                   text="Close",
                                   command=self.terminal.close)
        self.close_button.pack(side="right", fill="x", expand="yes")

        self.bframe.pack(side='bottom', fill='x')

        #load combo
        self.file_combo = Pmw.ComboBox(
            self,
            label_text='Load:',
            labelpos='nw',
            selectioncommand=self.load_selected,
            scrolledlist_items=[
                "Original File", "Specialised File", "Other..."
            ],
            dropdown=1,
        )
        #self.file_combo.component('entryfield').component('entry').configure(state="disabled")
        self.file_combo.pack(side="top", fill="y")
Ejemplo n.º 9
0
    def addProp(self, prop):
        if self.propWidgets.has_key(prop):
            return

        l = Tkinter.Label(self.propWidgetMaster, text=prop)
        l.grid(padx=2,
               pady=2,
               row=len(self.propWidgets) + 1,
               column=0,
               sticky='e')

        if prop in self.booleanProps:
            var = Tkinter.IntVar()
            var.set(0)
            cb = CallBackFunction(self.setBoolean, (prop, var))
            widget = Tkinter.Checkbutton(self.propWidgetMaster,
                                         variable=var,
                                         command=cb)
            self.propWidgets[prop] = (widget, var)
            self.setBoolean((prop, var))
        else:
            items = self.choiceProps[prop]
            var = None
            cb = CallBackFunction(self.setChoice, (prop, ))
            widget = Pmw.ComboBox(self.propWidgetMaster,
                                  entryfield_entry_width=15,
                                  scrolledlist_items=items,
                                  selectioncommand=cb)
            self.propWidgets[prop] = (widget, var)
            self.setChoice((prop, ), items[0])

        widget.grid(row=len(self.propWidgets), column=1, sticky='w')
Ejemplo n.º 10
0
 def __init__(self,
              master,
              items,
              default=None,
              allowNone=False,
              onSelChange=None):
     if allowNone:
         items = tuple([""] + list(items))
     self.items = items
     if havePMW:
         self.list = Pmw.ComboBox(master,
                                  selectioncommand=onSelChange,
                                  scrolledlist_items=items)
         self.list.component('entryfield').component('entry').configure(
             state='readonly', relief='raised')
         self.picked_name = self.list
     else:
         self.picked_name = StringVar(master)
         self.list = apply(OptionMenu,
                           (master, self.picked_name) + tuple(items))
         if onSelChange is not None:
             self.picked_name.trace("w", onSelChange)
     if default is not None:
         self.set(default)
     else:
         self.set(self.items[0])
Ejemplo n.º 11
0
 def __init__(self, parent):
     parent.configure(background='white')
     self.target = tkinter.Label(
         parent,
         relief='sunken',
         padx=20,
         pady=20,
     )
     self.target.pack(fill='x', padx=8, pady=8)
     colours = ('cornsilk1', 'snow1', 'seashell1', 'antiquewhite1',
                'bisque1', 'peachpuff1', 'navajowhite1', 'lemonchiffon1',
                'ivory1', 'honeydew1', 'lavenderblush1', 'mistyrose1')
     dropdown = Pmw.ComboBox(
         parent,
         label_text='Dropdown ComboBox:',
         labelpos='nw',
         selectioncommand=self.changeColour,
         scrolledlist_items=colours,
     )
     dropdown.pack(side='left',
                   anchor='n',
                   fill='x',
                   expand=1,
                   padx=8,
                   pady=8)
     first = colours[0]
     dropdown.selectitem(first)
     self.changeColour(first)
Ejemplo n.º 12
0
    def setup_mode_selector(self):
        """Mode selector

        User can select begining status of the world already exists,
        these status are called 'modes' here, and modes are save in
        file with json format
        """
        # read modes from json file
        # TODO use more simple ways to read
        try:
            modes_reader = open(self.modes_file, 'r')
            self.init_modes = json.load(modes_reader)
        except Exception:
            pass

        # set selector
        self.modes_names = self.init_modes.keys()
        self.modes_names.insert(0, "Set by hand")
        self.modes_selector = Pmw.ComboBox(
            self.toolbar,
            label_text = 'Modes selector',
            labelpos = 'nw',
            selectioncommand = self.prepare_world,
            scrolledlist_items = self.modes_names,
            )
        self.modes_selector.grid(row = 0, column = 0, sticky = tk.W)
        first = self.modes_names[0]
        self.modes_selector.selectitem(first)
        self.prepare_world(first)
Ejemplo n.º 13
0
        def gen_input_obj_combo(parent):
            '''Show the available loaded PyMOL objects in a ComboBox.'''
            obj_list = get_object_list()

            # Stop if there are no available objects.
            if len(obj_list) == 0:
                txt = 'No objects loaded! Please load a structure and restart the plugin.'
                w = tk.Label(parent, text=txt, padx=20, pady=20)
                w.pack()
                return None

            # Create a frame container
            frame = tk.Frame(parent)
            frame.pack(fill='x')

            # Create and populate the combo box
            combo = Pmw.ComboBox(
                frame,
                label_text='Base object name:',
                labelpos='w',
                selectioncommand=set_mpobj,
                scrolledlist_items=obj_list,
            )
            combo.grid(row=0, sticky='ew')

            # Create a refresh button
            btn = tk.Button(frame, text='Refresh List', command=update_combo)
            btn.grid(row=0, column=1)

            # Select first object by default if not previously set
            if not mpobj.get():
                combo.selectitem(obj_list[0])
                mpobj.set(obj_list[0])
            return combo
def valid():

    #fonction valider : elle donne un accès au menu déroulant contenant les collèges via un bouton "Valider"

    # Dans un pemier temps, on récupère le chemin du fichier contenant les nom des collèges

    filename = fileentry_college.get_path()
    fichier = open(filename, "r")
    lignes = fichier.readlines()
    fichier.close()

    print(lignes)

    # Dans un deuxième temps on crée la liste qui sera contenue dans le menu déroulant

    liste = []

    i = 0
    for ligne in lignes:
        if i > 0:
            listobj = ligne.split(',')
            liste.insert(i, listobj[0])
        i += 1

    # Création du menu déroulant

    combo = Pmw.ComboBox(labelpos='nw',
                         label_text='Choisissez le collège :',
                         scrolledlist_items=liste,
                         listheight=150)
    combo.pack(padx=5, pady=10)
Ejemplo n.º 15
0
 def __init__(self,
              master,
              filemask='*.mln',
              default=None,
              allowNone=False,
              onselchange=None,
              directory='.'):
     self.allowNone = allowNone
     self.directory = directory
     self.list_frame = master
     self.onchange = onselchange
     if type(filemask) != list:
         filemask = [filemask]
     self.file_mask = filemask
     self.updateList()
     if havePMW:
         self.list = Pmw.ComboBox(master,
                                  selectioncommand=onselchange,
                                  scrolledlist_items=self.files)
         self.list.component('entryfield').component('entry').configure(
             state='readonly', relief='raised')
         self.picked_name = self.list
     else:
         self.picked_name = StringVar(master)
         self.list = apply(OptionMenu,
                           (master, self.picked_name) + tuple(self.files))
         if onselchange is not None:
             self.picked_name.trace("w", onselchange)
     if default is not None:
         self.select(default)
     else:
         self.select(self.files[0])
Ejemplo n.º 16
0
 def mf_makeIncludeFileFrame(self, where):
     #self.includeFileList = Pmw.ScrolledListBox(where,
     #			listbox_selectmode = SINGLE,
     #			items = self.modelParserNames,
     #			labelpos = N,
     #			label_text = 'Included Files - Click To View - You will not get an editor',
     #			listbox_exportselection=0,
     #			selectioncommand = self.mf_selectIncludedFile)
     self.includeFileList = Pmw.ComboBox(
         where,
         scrolledlist_items=self.modelParserNames,
         labelpos=N,
         label_text=
         'Included Files - Click To View - You will not get an editor',
         listbox_exportselection=0,
         dropdown=1,
         selectioncommand=self.mf_selectIncludedFile)
     self.includeFileList.pack(side=TOP, fill=X, expand=YES)
     self.includeFileText = Pmw.ScrolledText(
         where,
         borderframe=1,
         labelpos=N,
         label_text='Selected Include File ',
         text_wrap='none')
     self.includeFileText.pack(side=TOP, fill=BOTH, expand=YES)
Ejemplo n.º 17
0
 def newCreateComboBox(self, parent, category, text,
                       help = '', command = None,
                       items = [], state = DISABLED, history = 0,
                       labelpos = W, label_anchor = W,
                       label_width = 16, entry_width = 16,
                       side = LEFT, fill = X, expand = 0, **kw):
     # Update kw to reflect user inputs
     kw['label_text'] = text
     kw['labelpos'] = labelpos
     kw['label_anchor'] = label_anchor
     kw['label_width'] = label_width
     kw['entry_width'] = entry_width
     kw['scrolledlist_items'] = items
     kw['entryfield_entry_state'] = state
     # Create widget
     widget = Pmw.ComboBox(parent, **kw)
     # Bind selection command
     widget['selectioncommand'] = command
     # Select first item if it exists
     if len(items) > 0:
         widget.selectitem(items[0])
     # Pack widget
     widget.pack(side = side, fill = fill, expand = expand)
     # Bind help
     self.bind(widget, help)
     # Record widget
     self.addWidget(category, text, widget)
     return widget
Ejemplo n.º 18
0
    def makeEntries(self):
        frame = self.frame
        self.maxResultVar = StringVar()
        self.maxDisplayVar = IntVar()
        #self.displayprogVar = StringVar()
        
        # entries for max results lines, dir size, etc.
        ewidth = 12
        etxt = 'no. of lines to show in results file'
        self.resEntry = Pmw.EntryField(frame, labelpos='e',label_text=etxt)
        self.resEntry.pack(side='top', anchor='w',padx=GG.padx, pady=GG.pady) 
        self.resEntry.component('entry').configure(width=ewidth)

        etxt = 'display program for images'
        self.dispEntry = Pmw.EntryField(frame, labelpos='e',label_text=etxt)
        self.dispEntry.pack(side='top', anchor='w',padx=GG.padx, pady=GG.pady) 
        self.dispEntry.component('entry').configure(width=ewidth)
  
        etxt = 'max. no. files to display'
        self.dirEntry = Pmw.EntryField(frame, labelpos='e',
                                  label_text=etxt,
                                  value = GG.prefs.MaxDisplayFiles)
        self.dirEntry.component('entry').configure(width=ewidth)
        self.dirEntry.pack(side='top', anchor='w',padx=GG.padx, pady=GG.pady)

        # drop-down menu for editor
        editors = GG.editorlist
        self.edit = Pmw.ComboBox(frame, label_text='editor',labelpos='e',
                                 dropdown=1,
                                 scrolledlist_items=editors)
        self.edit.pack(side='top', anchor='w',padx=GG.padx, pady=GG.pady)
Ejemplo n.º 19
0
    def bouton_chargement_xml(self):
        self.Text_faits.configure(state="normal")
        self.Text_faits.delete(1.0, tk.END)
        self.Text_regles.configure(state="normal")
        self.Text_regles.delete(1.0, tk.END)
        self.moteur = creation_moteur(self.Entry_regles.get())
        self.liste_des_faits = recuperation_des_faits(self.Entry_faits.get())
        string = ""
        for i, f in enumerate(self.liste_des_faits):
            string += "Fait " + str(i) + "\n\t" + str(f) + "\n"

        self.Text_faits.configure(state="normal")
        self.Text_faits.insert(tk.INSERT, string)
        self.Text_faits.configure(state="disabled")
        self.Text_regles.configure(state="normal")
        self.Text_regles.insert(tk.INSERT, str(self.moteur))
        self.Text_regles.configure(state="disabled")

        self.liste_but = self.generation_but()

        self.combo.destroy()
        self.faits_list = [" "] + list(map(lambda f: str(f), self.liste_but))
        self.combo = Pmw.ComboBox(self.Labelframe_moteur,
                                  scrolledlist_items=self.faits_list)
        self.combo.place(relx=0.383,
                         rely=0.364,
                         height=20,
                         relwidth=0.275,
                         bordermode='ignore')
Ejemplo n.º 20
0
    def symbolsMenu(self):
        w = Toplevel(self.top)
        w.title("Symbols")
        fs = Frame(w)

        Label(fs, text='symbols:').grid(row=0, column=0)
        sbox = Pmw.ComboBox(fs, scrolledlist_items=shapes, dropdown=1)
        sbox.selectitem(self.symbolshape)
        sbox.grid(row=0, column=1)
        sbox.bind('<Return>', lambda event, w=w: self.setsymbols(win=w))

        Label(fs, text='size:').grid(row=1, column=0)
        self.eVar1.set(str(self.symbolsize))
        esize = Entry(fs, textvariable=self.eVar1)
        esize.grid(row=1, column=1)
        esize.bind('<Return>', lambda event, w=w: self.setsymbols(win=w))

        Label(fs, text='color:').grid(row=2, column=0)
        self.eVar2.set(self.symbolcolor)
        ecol = Entry(fs, textvariable=self.eVar2)
        ecol.grid(row=2, column=1)
        ecol.bind('<Return>', lambda event, w=w: self.setsymbols(win=w))

        Label(fs, text='active color:').grid(row=3, column=0)
        self.eVar3.set(self.activecolor)
        acol = Entry(fs, textvariable=self.eVar3)
        acol.grid(row=3, column=1)
        acol.bind('<Return>', lambda event, w=w: self.setsymbols(win=w))

        self.newsymbols = (sbox, esize, ecol, acol)
        b = Button(fs, text='ok', command=lambda w=w: self.setsymbols(win=w))
        b.grid(row=4, column=1, sticky='e', padx=4, pady=4)
        fs.pack()
Ejemplo n.º 21
0
 def cBox(self, f, label, items):
     box = Pmw.ComboBox(f,
                        label_text=label,
                        labelpos='w',
                        scrolledlist_items=items)
     box.pack(fill='both', expand=1, padx=8, pady=8)
     return box
Ejemplo n.º 22
0
def _runMemoryLeakTest():
    global top
    top = MyToplevel()
    Pmw.MegaToplevel(top)
    Pmw.AboutDialog(top)
    Pmw.ComboBoxDialog(top)
    Pmw.CounterDialog(top)
    Pmw.Dialog(top)
    Pmw.MessageDialog(top)
    Pmw.PromptDialog(top)
    Pmw.SelectionDialog(top)
    Pmw.TextDialog(top)

    Pmw.ButtonBox(top).pack()
    Pmw.ComboBox(top).pack()
    Pmw.Counter(top).pack()
    Pmw.EntryField(top).pack()
    Pmw.Group(top).pack()
    Pmw.LabeledWidget(top).pack()
    Pmw.MenuBar(top).pack()
    Pmw.MessageBar(top).pack()
    Pmw.NoteBook(top).pack()
    Pmw.OptionMenu(top).pack()
    Pmw.PanedWidget(top).pack()
    Pmw.RadioSelect(top).pack()
    Pmw.ScrolledCanvas(top).pack()
    Pmw.ScrolledField(top).pack()
    Pmw.ScrolledFrame(top).pack()
    Pmw.ScrolledListBox(top).pack()
    Pmw.ScrolledText(top).pack()
    Pmw.TimeCounter(top).pack()
Ejemplo n.º 23
0
def askMessage(p, pos, ports):
    d = Pmw.Dialog(p, buttons=('OK', 'Cancel'), defaultbutton='OK')
    n = Pmw.EntryField(d.interior(), labelpos='w', label_text="Message Name")
    p = Pmw.ComboBox(d.interior(),
                     labelpos='w',
                     label_text='Port Name',
                     scrolledlist_items=ports)
    p.selectitem(0)
    dir = Pmw.RadioSelect(d.interior(), labelpos='w', label_text="Direction")
    dir.pack()
    dir.add('INCOMING')
    dir.add('OUTGOING')
    dir.invoke('INCOMING')
    tim = Pmw.RadioSelect(d.interior(), labelpos='w', label_text="Timing")
    tim.pack()
    tim.add('SYNCHRONOUS')
    tim.add('ASYNCHRONOUS')
    tim.invoke('ASYNCHRONOUS')
    n.pack()
    p.pack()
    d.withdraw()
    n.component("entry").focus_set()
    res = d.activate(geometry=pos)
    if res == 'OK':
        if n.get():
            return {
                'name': n.get(),
                'port': p.get(),
                'dir': dir.getcurselection(),
                'tim': tim.getcurselection()
            }
    return None
Ejemplo n.º 24
0
def askProcNamePortName(p, pos, ports):
    d = Pmw.Dialog(p, buttons=('OK', 'Cancel'), defaultbutton='OK')
    n = Pmw.EntryField(d.interior(), labelpos='w', label_text="Procedure Name")
    p = Pmw.ComboBox(d.interior(),
                     labelpos='w',
                     label_text='Port Name',
                     scrolledlist_items=ports)
    p.selectitem(0)
    v = Pmw.RadioSelect(d.interior(), labelpos='w', label_text="Visibility")
    v.pack()
    v.add('Internal')
    v.add('External')
    v.invoke('External')
    n.pack()
    p.pack()
    d.withdraw()
    n.component("entry").focus_set()
    res = d.activate(geometry=pos)
    if res == 'OK':
        if n.get():
            return {
                'name': n.get(),
                'port': p.get(),
                'visibility': v.getcurselection()
            }
    return None
Ejemplo n.º 25
0
 def gui(self):
     fr = Frame(self)
     b=Button(fr,text='load csv',command=self.importCSV)
     b.pack(side=LEFT,fill=BOTH,padx=1)
     b=Button(fr,text='load ekin',command=self.loadProject)
     b.pack(side=LEFT,fill=BOTH,padx=1)
     self.stopbtn=Button(fr,text='stop',command=self.stopFit)#,state=DISABLED)
     self.stopbtn.pack(side=LEFT,fill=BOTH,padx=1)
     self.previmg = Ekin_images.prev()
     b=Button(fr,text='prev',image=self.previmg,command=self.prev)
     b.pack(side=LEFT,fill=BOTH)
     self.nextimg = Ekin_images.next()
     b=Button(fr,text='next',image=self.nextimg,command=self.next)
     b.pack(side=LEFT,fill=BOTH)
     fr.pack(side=TOP)
     self.dsetselector = Pmw.ComboBox(fr, entry_width=15,
                     selectioncommand = self.selectDataset)
     self.dsetselector.pack(side=LEFT,fill=BOTH,padx=1)
     fr2 = Frame(self)
     fr2.pack(side=TOP)
     self.plotfunctionvar = IntVar()
     cb=Checkbutton(fr2, text='plot function only',variable=self.plotfunctionvar)
     cb.pack(side=TOP)
     self.plotframe = PlotPanel(parent=self, side=BOTTOM, height=200)
     self.dsindex = 0
     self.opts = {'markersize':18,'fontsize':10,'showfitvars':True}
     return
Ejemplo n.º 26
0
    def __init__(self, parent, name, editor):
        SingleEditor.__init__(self, parent, name, editor)
        choices = self.editor.canvas.listelements(name)
        choices = map(lambda x: x.strip(), choices)
        if self.original_value not in choices:
            showerror(
                'Error Message',
                self.editor.name + ' does not have a choice ' +
                self.original_value + ' for ' + name + """.
                      Will change to first choice available.""")
            self.original_value = choices[0]

        w = 8
        for x in choices:
            w = max(w, len(x))
        self.widget = Pmw.ComboBox(
            self.interior(),
            history=0,
            scrolledlist_items=choices,
            selectioncommand=self.changed,
        )

        self.widget.selectitem(self.original_value)
        self.widget.component('entry').configure(width=w, state='disabled')
        self.widget.pack(fill='both', expand=1)
        self.widget.component('entry').unbind("<Return>")
        self.set(self.original_value)
Ejemplo n.º 27
0
    def __init__(self, filename=None, dialog=None, label=None):
        self.w = newWindow(title="Add batch file")
        if self.w == 0: return

        # -------------------------------
        top = Frame(self.w,
                    background=GG.bgd01,
                    relief=GG.frelief,
                    borderwidth=GG.brdr)
        top.pack(side='top', fill='x', expand=1)
        Label(top, text="Add a batch file to a dialog",
              background=GG.bgd01).pack()

        # -------------------------------
        mid = Frame(self.w)
        mid.pack(side='top', fill='both', expand=1)
        # dialog pulldown menu
        self.dialogs = []
        if hasConfig():
            for d in GB.C.Dialogs['dialogList']:
                if d == '.':
                    self.dialogs.append(GB.project_dir_title)
                else:
                    self.dialogs.append(d)

        self.dialog = Pmw.ComboBox(mid,
                                   label_text='Dialog: ',
                                   labelpos='w',
                                   scrolledlist_items=self.dialogs)
        if dialog != None and dialog in self.dialogs:
            self.dialog.selectitem(dialog)
        self.dialog.pack(side='top', fill='x', expand=1, padx=4, pady=4)
        # label entry
        self.label = Pmw.EntryField(mid, labelpos='w', label_text="Label: ")
        self.label.pack(side='top', fill='x', expand=1, padx=4, pady=4)
        if label != None:
            self.label.setvalue(label)
        # file entry
        self.batfile = Pmw.EntryField(mid,
                                      labelpos='w',
                                      label_text="Filename : ")
        self.batfile.pack(side='left', fill='x', expand=1, padx=4, pady=4)
        if filename != None:
            self.batfile.setvalue(filename)
        browse = Button(mid,
                        text="Browse",
                        command=Command(getFile, self.batfile))
        browse.pack(side='right', padx=4, pady=4)

        # -------------------------------
        bot = Frame(self.w,
                    background=GG.bgd01,
                    relief=GG.frelief,
                    borderwidth=GG.brdr)
        bot.pack(side='bottom', fill='x', expand=1)
        ok = Button(bot, text='Ok', command=self.addBatch)
        quit = Button(bot, text='Cancel', command=self.w.destroy)
        ok.pack(side='left', padx=4, pady=4)
        quit.pack(side='right', padx=4, pady=4)
Ejemplo n.º 28
0
 def makeComboBox(self, txt, opts):
     self.i = Pmw.ComboBox(self,
                           labelpos=W,
                           label_text=txt,
                           listheight=60,
                           listbox_width=24,
                           scrolledlist_items=opts)
     return self.i
Ejemplo n.º 29
0
    def getOptions(self):
        self.optwin = Toplevel(self.master)
        self.optwin.title('Options')
        f1 = Frame(self.optwin)
        f1.pack(side='top', fill='both', expand=1)
        width = 9
        imglbl = Label(f1, text="Max image size:")
        imgxentry = Entry(f1, textvariable=self.imgxmax, width=width)
        imglbl2 = Label(f1, text=" x ")
        imgyentry = Entry(f1, textvariable=self.imgymax, width=width)
        imglbl.grid(row=0, column=0, sticky="e")
        imgxentry.grid(row=0, column=1, sticky="ew")
        imglbl2.grid(row=0, column=2, sticky="e")
        imgyentry.grid(row=0, column=3, sticky="ew")

        txtlbl = Label(f1, text="Max text file:")
        txtentry = Entry(f1, textvariable=self.textmax, width=width)
        txtlbl2 = Label(f1, text="bytes")
        txtlbl.grid(row=1, column=0, sticky="e")
        txtentry.grid(row=1, column=1, sticky="ew")
        txtlbl2.grid(row=1, column=2, columnspan=2, sticky="w")

        dirlbl = Label(f1, text="Max directory size:")
        direntry = Entry(f1, textvariable=self.dirmax, width=width)
        dirlbl2 = Label(f1, text="bytes")
        dirlbl.grid(row=2, column=0, sticky="e")
        direntry.grid(row=2, column=1, sticky="ew")
        dirlbl2.grid(row=2, column=2, columnspan=2, sticky="w")

        f2 = Frame(self.optwin)
        f2.pack(side='top', fill='both', expand=1)
        hcb = Checkbutton(f2,
                          text="Display html files in browser",
                          variable=self.htmlVar)
        hcb.pack(anchor='w', side='top', padx=5, pady=5, fill='x', expand=1)
        ecb = Checkbutton(f2,
                          text="Allow text files to be edited",
                          variable=self.editVar)
        ecb.pack(anchor='w', side='top', padx=5, pady=5, fill='x', expand=1)

        displaylist = ['jweb', 'xv', 'qview.py']

        self.disprog = Pmw.ComboBox(f2,
                                    labelpos='w',
                                    label_text='Display program:',
                                    scrolledlist_items=displaylist,
                                    dropdown=1)
        self.disprog.selectitem(self.displayProg.get(), setentry=1)
        self.disprog.pack(anchor='w',
                          side='top',
                          padx=5,
                          pady=5,
                          fill='x',
                          expand=1)

        ok = Button(self.optwin, text='Done', command=self.setOptions)
        ok.pack(side='bottom', anchor='se', padx=2, pady=2)
Ejemplo n.º 30
0
 def createComboBox(self, parent, category, text, balloonHelp, items, command, history = 0):
     widget = Pmw.ComboBox(parent, labelpos = W, label_text = text, label_anchor = 'w', label_width = 12, entry_width = 16, history = history, scrolledlist_items = items)
     if len(items) > 0:
         widget.selectitem(items[0])
     
     widget['selectioncommand'] = command
     widget.pack(side = 'left', expand = 0)
     self.bind(widget, balloonHelp)
     self.widgetDict[category + '-' + text] = widget
     return widget