Example #1
0
    def createWidgets(self):
        "Create initial widget set."

        # Objects
        title = Label(self, text='Bandwidth (Gb/s)', bg=self.bg)
        width = self.gwidth
        height = self.gheight
        scale = self.createScale()
        graph = Canvas(self, width=width, height=height, background=self.bg)
        xbar = Scrollbar(self, orient='horizontal', command=graph.xview)
        ybar = Scrollbar(self, orient='vertical', command=self.yview)
        graph.configure(xscrollcommand=xbar.set,
                        yscrollcommand=ybar.set,
                        scrollregion=(0, 0, width, height))
        scale.configure(yscrollcommand=ybar.set)

        # Layout
        title.grid(row=0, columnspan=3, sticky='new')
        scale.grid(row=1, column=0, sticky='nsew')
        graph.grid(row=1, column=1, sticky='nsew')
        ybar.grid(row=1, column=2, sticky='ns')
        xbar.grid(row=2, column=0, columnspan=2, sticky='ew')
        self.rowconfigure(1, weight=1)
        self.columnconfigure(1, weight=1)
        return title, scale, graph
Example #2
0
    def _init_components(self):
        self.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1)

        upper_pane = Frame(self)
        upper_pane.columnconfigure(0, weight=1)
        upper_pane.rowconfigure(0, weight=1)

        self.apex_list = ApexList(upper_pane, self._apex)
        self.apex_list.grid(row=0, column=0, sticky='nesw')

        self._scrollbar_x = Scrollbar(upper_pane,
                                      command=self.apex_list.xview,
                                      orient='horizontal')
        self._scrollbar_x.grid(row=1, column=0, sticky='ews')
        self.apex_list['xscrollcommand'] = self._scrollbar_x.set
        self._scrollbar_y = Scrollbar(upper_pane, command=self.apex_list.yview)
        self._scrollbar_y.grid(row=0, column=1, sticky='nse')
        self.apex_list['yscrollcommand'] = self._scrollbar_y.set

        buttons_pane = Frame(self)

        self._expand_button = Button(buttons_pane,
                                     text="Expand all",
                                     command=self.apex_list.expand_all)
        self._expand_button.pack(side='left', expand=True, fill='x')

        self._reset_button = Button(buttons_pane,
                                    text="Reset",
                                    command=self.apex_list.reset)
        self._reset_button.pack()

        upper_pane.grid(sticky='nesw')
        buttons_pane.grid(row=1, sticky='nesw')
Example #3
0
    def createCanvas( self ):
        "Create and return our scrolling canvas frame."
        f = Frame( self )

        canvas = Canvas( f, width=self.cwidth, height=self.cheight,
                         bg=self.bg )

        # Scroll bars
        xbar = Scrollbar( f, orient='horizontal', command=canvas.xview )
        ybar = Scrollbar( f, orient='vertical', command=canvas.yview )
        canvas.configure( xscrollcommand=xbar.set, yscrollcommand=ybar.set )

        # Resize box
        resize = Label( f, bg='white' )

        # Layout
        canvas.grid( row=0, column=1, sticky='nsew')
        ybar.grid( row=0, column=2, sticky='ns')
        xbar.grid( row=1, column=1, sticky='ew' )
        resize.grid( row=1, column=2, sticky='nsew' )

        # Resize behavior
        f.rowconfigure( 0, weight=1 )
        f.columnconfigure( 1, weight=1 )
        f.grid( row=0, column=0, sticky='nsew' )
        f.bind( '<Configure>', lambda event: self.updateScrollRegion() )

        # Mouse bindings
        canvas.bind( '<ButtonPress-1>', self.clickCanvas )
        canvas.bind( '<B1-Motion>', self.dragCanvas )
        canvas.bind( '<ButtonRelease-1>', self.releaseCanvas )

        return f, canvas
Example #4
0
    def __init__(self, parent, tile_size, grid_vm=None):
        Frame.__init__(self, parent, relief=RAISED, borderwidth=1)
        self.parent = parent
        self.tile_size = tile_size
        self.grid_vm = grid_vm
        self.columnconfigure(0, weight=1)
        self.columnconfigure(1, pad=3)
        self.rowconfigure(0, weight=1)
        self.rowconfigure(1, pad=3)
        hbar = Scrollbar(self, orient=HORIZONTAL)
        vbar = Scrollbar(self, orient=VERTICAL)
        canvas = Canvas(self, xscrollcommand=hbar.set, yscrollcommand=vbar.set)
        self.canvas = canvas
        self.lines = []

        canvas.bind_all("<MouseWheel>", self._on_mousewheel_vertical)
        canvas.bind_all("<Shift-MouseWheel>", self._on_mousewheel_horizontal)

        # Set up scroll bars
        hbar.pack(side=BOTTOM, fill=X)
        hbar.config(command=canvas.xview)
        vbar.pack(side=RIGHT, fill=Y)
        vbar.config(command=canvas.yview)

        canvas.grid(column=0, row=0, sticky=N + W + E + S)
        hbar.grid(column=0, row=1, sticky=W + E)
        vbar.grid(column=1, row=0, sticky=N + S)

        if grid_vm:
            self.set_vm(grid_vm)
Example #5
0
 def _init_results_box(self, parent):
     innerframe = Frame(parent)
     i1 = Frame(innerframe)
     i2 = Frame(innerframe)
     vscrollbar = Scrollbar(i1, borderwidth=1)
     hscrollbar = Scrollbar(i2, borderwidth=1, orient='horiz')
     self.results_box = Text(i1,
                             font=tkFont.Font(family='courier', size='16'),
                             state='disabled',
                             borderwidth=1,
                             yscrollcommand=vscrollbar.set,
                             xscrollcommand=hscrollbar.set,
                             wrap='none',
                             width='40',
                             height='20',
                             exportselection=1)
     self.results_box.pack(side='left', fill='both', expand=True)
     self.results_box.tag_config(self._HIGHLIGHT_WORD_TAG,
                                 foreground=self._HIGHLIGHT_WORD_COLOUR)
     self.results_box.tag_config(self._HIGHLIGHT_LABEL_TAG,
                                 foreground=self._HIGHLIGHT_LABEL_COLOUR)
     vscrollbar.pack(side='left', fill='y', anchor='e')
     vscrollbar.config(command=self.results_box.yview)
     hscrollbar.pack(side='left', fill='x', expand=True, anchor='w')
     hscrollbar.config(command=self.results_box.xview)
     #there is no other way of avoiding the overlap of scrollbars while using pack layout manager!!!
     Label(i2, text='   ',
           background=self._BACKGROUND_COLOUR).pack(side='left', anchor='e')
     i1.pack(side='top', fill='both', expand=True, anchor='n')
     i2.pack(side='bottom', fill='x', anchor='s')
     innerframe.pack(side='top', fill='both', expand=True)
Example #6
0
    def __init__(self, parent, *args, **kw):
        Frame.__init__(self, parent, *args, **kw)

        # create a canvas object and a vertical scrollbar for scrolling it
        vscrollbar = Scrollbar(self, orient=Tkinter.VERTICAL)
        vscrollbar.pack(fill=Tkinter.Y,
                        side=Tkinter.RIGHT,
                        expand=Tkinter.FALSE)

        hscrollbar = Scrollbar(self, orient=Tkinter.HORIZONTAL)
        hscrollbar.pack(fill=Tkinter.X,
                        side=Tkinter.BOTTOM,
                        expand=Tkinter.FALSE)

        canvas = Canvas(self,
                        bd=0,
                        highlightthickness=0,
                        yscrollcommand=vscrollbar.set,
                        xscrollcommand=hscrollbar.set)
        canvas.pack(side=Tkinter.LEFT, fill=Tkinter.BOTH, expand=Tkinter.TRUE)
        vscrollbar.config(command=canvas.yview)
        hscrollbar.config(command=canvas.xview)

        # reset the view

        canvas.xview_moveto(0)
        canvas.yview_moveto(0)

        # create a frame inside the canvas which will be scrolled with it

        self.interior = interior = Frame(canvas)
        interior_id = canvas.create_window(0,
                                           0,
                                           window=interior,
                                           anchor=Tkinter.NW)

        # track changes to the canvas and frame width and sync them,
        # also updating the scrollbar

        def _configure_interior(event):
            '''
            update the scrollbars to match the size of the inner frame
            '''
            size = (interior.winfo_reqwidth(), interior.winfo_reqheight())
            canvas.config(scrollregion='0 0 %s %s' % size)
            if interior.winfo_reqwidth() != canvas.winfo_width():
                # update the canvas's width to fit the inner frame
                canvas.config(width=interior.winfo_reqwidth())

        interior.bind('<Configure>', _configure_interior)

        def _configure_canvas(event):
            '''
            _configure_canvas is used to resize the window size to fit content.
            Can be used when changing window.
            '''

            if interior.winfo_reqwidth() != canvas.winfo_width():
                # update the inner frame's width to fill the canvas
                canvas.itemconfigure(interior_id, width=canvas.winfo_width())
Example #7
0
    def __init__(self, master=None):
        Frame.__init__(self, master)

        self.parent = master

        self.parent.geometry("640x480")
        self.parent.title(os.getenv("NAME") + " - Stdout")

        self.textedit = Text(self.parent, font="mono 10")
        self.textedit.pack(expand=True, fill=BOTH)
        buton = Button(self.parent, text="Close", command=self.quit)
        buton.pack(side=RIGHT, expand=False, padx=10, pady=10, ipadx=10)

        ysb = Scrollbar(self.textedit,
                        orient='vertical',
                        command=self.textedit.yview)
        xsb = Scrollbar(self.textedit,
                        orient='horizontal',
                        command=self.textedit.xview)

        self.textedit.configure(yscroll=ysb.set, xscroll=xsb.set)

        xsb.pack(side=BOTTOM, fill=X, expand=False)
        ysb.pack(side=RIGHT, fill=Y, expand=False)

        self.textedit.pack(side=TOP, fill=BOTH, expand=True)

        self.show_file()
Example #8
0
    def __init__(self, master=None, change_hook=None, **kw):
        self.frame = Frame(master)
        self.vbar = Scrollbar(self.frame)
        self.vbar.pack(side=RIGHT, fill=Y)

        self.hbar = Scrollbar(self.frame, orient=HORIZONTAL)
        self.hbar.pack(side=BOTTOM, fill=X)

        kw.update({'yscrollcommand': self.vbar.set})
        kw.update({'xscrollcommand': self.hbar.set})
        kw.update({'wrap': 'none'})
        Text.__init__(self, self.frame, **kw)
        self.pack(side=LEFT, fill=BOTH, expand=True)
        self.vbar['command'] = self.yview
        self.hbar['command'] = self.xview

        # Copy geometry methods of self.frame without overriding Text
        # methods -- hack!
        text_meths = vars(Text).keys()
        methods = vars(Pack).keys() + vars(Grid).keys() + vars(Place).keys()
        methods = set(methods).difference(text_meths)

        for m in methods:
            if m[0] != '_' and m != 'config' and m != 'configure':
                setattr(self, m, getattr(self.frame, m))
Example #9
0
def addScrollingFigure(figure, frame):
    global canvas, mplCanvas, interior, interior_id, cwid
    # set up a canvas with scrollbars
    canvas = Canvas(frame)
    canvas.grid(row=1, column=1, sticky=Tkconstants.NSEW)

    xScrollbar = Scrollbar(frame, orient=Tkconstants.HORIZONTAL)
    yScrollbar = Scrollbar(frame)

    xScrollbar.grid(row=2, column=1, sticky=Tkconstants.EW)
    yScrollbar.grid(row=1, column=2, sticky=Tkconstants.NS)

    canvas.config(xscrollcommand=xScrollbar.set)
    xScrollbar.config(command=canvas.xview)
    canvas.config(yscrollcommand=yScrollbar.set)
    yScrollbar.config(command=canvas.yview)

    # plug in the figure
    figAgg = FigureCanvasTkAgg(figure, canvas)
    mplCanvas = figAgg.get_tk_widget()

    # and connect figure with scrolling region
    cwid = canvas.create_window(0, 0, window=mplCanvas, anchor=Tkconstants.NW)
    printBboxes("Init")
    changeSize(figure, 1)
Example #10
0
    def buildDisplay(self):
        winWidth = 1000
        winHeight = 800
        frame = Frame(self.root, width=winWidth, height=winHeight)
        frame.pack(side=TOP, expand=YES, fill=X)

        c = Canvas(frame,
                   width=winWidth,
                   height=winHeight,
                   scrollregion=(0, 0, self.canvasWidth, self.canvasHeight))

        hbar = Scrollbar(frame, orient=HORIZONTAL)
        hbar.pack(side=BOTTOM, fill=X)
        hbar.config(command=c.xview)
        vbar = Scrollbar(frame, orient=VERTICAL)
        vbar.pack(side=RIGHT, fill=Y)
        vbar.config(command=c.yview)

        c.config(xscrollcommand=hbar.set, yscrollcommand=vbar.set)
        c.pack(side=LEFT, expand=YES, fill=BOTH)
        self.canvas = c

        editFrame = Frame(self.root, width=winWidth, height=0)
        editFrame.pack(side=BOTTOM, fill=X)
        self.editFrame = editFrame
Example #11
0
def xGC_skew(seq, window = 1000, zoom = 100,
                         r = 300, px = 100, py = 100):
    """Calculates and plots normal and accumulated GC skew (GRAPHICS !!!)."""
    from Tkinter import Scrollbar, Canvas, BOTTOM, BOTH, ALL, \
                        VERTICAL, HORIZONTAL, RIGHT, LEFT, X, Y
    yscroll = Scrollbar(orient = VERTICAL)
    xscroll = Scrollbar(orient = HORIZONTAL)
    canvas = Canvas(yscrollcommand = yscroll.set,
                    xscrollcommand = xscroll.set, background = 'white')
    win = canvas.winfo_toplevel()
    win.geometry('700x700')

    yscroll.config(command = canvas.yview)
    xscroll.config(command = canvas.xview)
    yscroll.pack(side = RIGHT, fill = Y)
    xscroll.pack(side = BOTTOM, fill = X)
    canvas.pack(fill=BOTH, side = LEFT, expand = 1)
    canvas.update()

    X0, Y0 = r + px, r + py
    x1, x2, y1, y2 = X0 - r, X0 + r, Y0 -r, Y0 + r

    ty = Y0
    canvas.create_text(X0, ty, text = '%s...%s (%d nt)' % (seq[:7], seq[-7:], len(seq)))
    ty +=20
    canvas.create_text(X0, ty, text = 'GC %3.2f%%' % (GC(seq)))
    ty +=20
    canvas.create_text(X0, ty, text = 'GC Skew', fill = 'blue')
    ty +=20
    canvas.create_text(X0, ty, text = 'Accumulated GC Skew', fill = 'magenta')
    ty +=20
    canvas.create_oval(x1,y1, x2, y2)

    acc = 0
    start = 0
    for gc in GC_skew(seq, window):
        r1 = r
        acc+=gc
        # GC skew
        alpha = pi - (2*pi*start)/len(seq)
        r2 = r1 - gc*zoom
        x1 = X0 + r1 * sin(alpha)
        y1 = Y0 + r1 * cos(alpha)
        x2 = X0 + r2 * sin(alpha)
        y2 = Y0 + r2 * cos(alpha)
        canvas.create_line(x1,y1,x2,y2, fill = 'blue')
        # accumulated GC skew
        r1 = r - 50
        r2 = r1 - acc
        x1 = X0 + r1 * sin(alpha)
        y1 = Y0 + r1 * cos(alpha)
        x2 = X0 + r2 * sin(alpha)
        y2 = Y0 + r2 * cos(alpha)
        canvas.create_line(x1,y1,x2,y2, fill = 'magenta')

        canvas.update()
        start += window

    canvas.configure(scrollregion = canvas.bbox(ALL))
Example #12
0
    def __init__(self, master, mech):
        self.mech = mech
        frame = Frame(master)
        frame.grid()
        rct_label = Label(frame, text='Select Reactants')
        rct_label.grid(column=1, row=1)
        and_or = Label(frame, text='AND/OR')
        and_or.grid(column=3, row=1)
        prod_label = Label(frame, text='Select Products')
        prod_label.grid(column=4, row=1)
        what_to_do = Label(frame, text='Execute')
        what_to_do.grid(column=6, row=1)
        reactants_scrollbar = Scrollbar(frame, orient=VERTICAL)
        self.reactants = Listbox(frame,
                                 selectmode=EXTENDED,
                                 exportselection=0,
                                 yscrollcommand=reactants_scrollbar.set)
        self.reactants.grid(column=1, row=2)
        reactants_scrollbar.config(command=self.reactants.yview)
        reactants_scrollbar.grid(column=2, row=2, sticky=N + S)

        self.logical_and = IntVar()
        self.logical_and.set(1)
        c = Checkbutton(frame, text="AND", variable=self.logical_and)
        c.grid(column=3, row=2)

        products_scrollbar = Scrollbar(frame, orient=VERTICAL)
        self.products = Listbox(frame, selectmode=EXTENDED, exportselection=0)
        self.products.grid(column=4, row=2)
        products_scrollbar.config(command=self.products.yview)
        products_scrollbar.grid(column=5, row=2, sticky=N + S)

        self.method_list = Listbox(frame,
                                   selectmode=EXTENDED,
                                   exportselection=0)
        self.method_list.grid(column=6, row=2)
        #self.methods = [k for k in dir(self.mech) if k[:1] != '_' and isinstance(getattr(self.mech, k), MethodType)]
        self.methods = [
            'plot_rxns', 'find_rxns', 'print_rxns', 'print_irrs',
            'print_net_rxn', 'plot_proc'
        ]
        method_labels = [
            'Plot Reactions', 'Show Rxn Ids', 'Print Rxns', 'Print IRRs',
            'Print Net Rxn', 'Process Plot'
        ]
        for method in method_labels:
            self.method_list.insert(END, method)

        species_keys = self.mech.species_dict.keys()
        species_keys.sort()
        self.species_objects = [
            self.mech.species_dict[spc] for spc in species_keys
        ]

        for spc in species_keys:
            self.reactants.insert(END, spc)
            self.products.insert(END, spc)
        self.execute_button = Button(frame, text="go", command=self.execute)
        self.execute_button.grid(column=6, row=4)
Example #13
0
def setScrollBar(canvas,frame):
    hbar=Scrollbar(frame,orient=HORIZONTAL)
    hbar.pack(side=BOTTOM,fill=X)
    hbar.config(command=canvas.xview)
    vbar=Scrollbar(frame,orient=VERTICAL)
    vbar.pack(side=RIGHT,fill=Y)
    vbar.config(command=canvas.yview)
    canvas.config(xscrollcommand=hbar.set, yscrollcommand=vbar.set)
    canvas.pack(side=LEFT,expand=True,fill=BOTH)
Example #14
0
def displaysampleAutomata(event):
    global frameSampleDisplay
    try:
        if (srcStateTextVariable.get())=='':
            tkMessageBox.showerror("Initial State","Please select an initial state first.")
            return
        elif (destStateTextVariable.get())=='':
            tkMessageBox.showerror("Accepting States","Please select accepting states first.")
            return
        
        if sInputCheck.get()==1:
            import resizeimage
            frameSampleDisplay=ttk.LabelFrame(statsFrame,width=300,height=200)
            samplaCanvas=Canvas(frameSampleDisplay,bg='#FFFFFF',height=200,width=300)
            configGrid(frameSampleDisplay,1,2,1,1)
            samplaCanvas.pack(side=tk.TOP,fill=BOTH)
            filename='../graph/sample.png'
            
            def displaySampleFSM():
                resizeimage.resizeImage(filename,0.5)
                img = PhotoImage(file="../graph/sample0.5.png")
                label1.image = img # keep a reference!
                
                samplaCanvas.delete(img) #reset canvas
                samplaCanvas.create_image(0, 80, anchor='nw',image=img,tags="bg_img")
                
            displaySampleFSM()
            vbar=Scrollbar(frameSampleDisplay,orient=VERTICAL)
            vbar.pack(side=tk.RIGHT,fill=Y,anchor='ne')
            hbar=Scrollbar(frameSampleDisplay,orient=HORIZONTAL)
            hbar.pack(side=tk.TOP,fill=X,anchor='sw')
            hbar.config(command=samplaCanvas.xview)
            vbar.config(command=samplaCanvas.yview)
            canvas.config(xscrollcommand=hbar.set, yscrollcommand=vbar.set)
            
            samplaCanvasLogFrame=Canvas(frameSampleDisplay,bg='#FFFFFF',height=200,width=300)
            samplaCanvasLogFrame.pack(side=BOTTOM)
            displaysamplelogProcesslog=ttk.Button(samplaCanvasLogFrame,text='Process Log',width=10)
            displaysamplelogProcesslog.pack(side=LEFT,fill=X,anchor='w')
            displaysamplelogFSM=ttk.Button(samplaCanvasLogFrame,text='FSM',width=10,command=combine_funcs(generateSampleAutomata,displaySampleFSM))
            
            displaysamplelogFSM.pack(side=LEFT,fill=X,anchor='e')
            
            displaysamplelogPreview=ttk.Button(samplaCanvasLogFrame,text='Preview',width=10)
            displaysamplelogPreview.pack(side=LEFT,fill=X,anchor='e')
            
            def displaysampleFromBrowsercallback(event):
                displayFromBrowser(samplaCanvas,'sample')
                
            displaysamplelogPreview.bind('<ButtonRelease-1>',displaysampleFromBrowsercallback)
            
        elif sInputCheck.get()==0:
            #frameSampleDisplay.pack_forget()
            frameSampleDisplay.grid_forget() #Remove the Frame
    except (NameError,Exception):
        pass
Example #15
0
    def _build_listbox(self, values):
        listbox_frame = Frame()

        self._listbox = Listbox(listbox_frame,
                                background="white",
                                selectmode=SINGLE,
                                activestyle="none",
                                exportselection=False)
        self._listbox.grid(row=0, column=0, sticky=N + E + W + S)

        self._listbox.bind("<ButtonRelease-1>",
                           self._update_entry_from_listbox)
        self._listbox.bind("<Return>", self._update_entry_from_listbox)
        self._listbox.bind("<Escape>", lambda event: self.unpost_listbox())

        self._listbox.bind('<Control-n>', self._next)
        self._listbox.bind('<Control-p>', self._previous)

        if self._use_vscrollbar:
            vbar = Scrollbar(listbox_frame,
                             orient=VERTICAL,
                             command=self._listbox.yview)
            vbar.grid(row=0, column=1, sticky=N + S)

            self._listbox.configure(
                yscrollcommand=lambda f, l: autoscroll(vbar, f, l))

        if self._use_hscrollbar:
            hbar = Scrollbar(listbox_frame,
                             orient=HORIZONTAL,
                             command=self._listbox.xview)
            hbar.grid(row=1, column=0, sticky=E + W)

            self._listbox.configure(
                xscrollcommand=lambda f, l: autoscroll(hbar, f, l))

        listbox_frame.grid_columnconfigure(0, weight=1)
        listbox_frame.grid_rowconfigure(0, weight=1)

        x = -self.cget("borderwidth") - self.cget("highlightthickness")
        y = self.winfo_height() - self.cget("borderwidth") - self.cget(
            "highlightthickness")

        if self._listbox_width:
            width = self._listbox_width
        else:
            width = self.winfo_width()

        listbox_frame.place(in_=self, x=x, y=y, width=width)

        height = min(self._listbox_height, len(values))
        self._listbox.configure(height=height)

        for item in values:
            self._listbox.insert(END, item)
Example #16
0
 def __init__(self):
     self.root = Tk()
     self.input_type = Tkinter.IntVar()
     self.input_type.set(1)
     self.normalize_data = Tkinter.IntVar()
     self.normalize_data.set(1)
     self.root.title("Code energy calculator")
     self.left_frame = LabelFrame(self.root, text="Input and output")
     self.left_frame.pack(side=Tkinter.LEFT,
                          fill=Tkinter.BOTH,
                          expand=True,
                          padx=(10, 5),
                          pady=10)
     self.right_frame = LabelFrame(self.root, text="Code")
     self.right_frame.pack(side=Tkinter.RIGHT,
                           fill=Tkinter.BOTH,
                           expand=True,
                           padx=(5, 10),
                           pady=10)
     code_hscroll = Scrollbar(self.right_frame, orient=Tkinter.HORIZONTAL)
     code_hscroll.pack(side=Tkinter.BOTTOM, fill=Tkinter.X)
     code_vscroll = Scrollbar(self.right_frame)
     code_vscroll.pack(side=Tkinter.RIGHT, fill=Tkinter.Y)
     self.code_text = Text(self.right_frame,
                           wrap=Tkinter.NONE,
                           xscrollcommand=code_hscroll.set,
                           yscrollcommand=code_vscroll.set)
     self.code_text.pack()
     self.code_text.insert(Tkinter.INSERT, DEFAULT_CODE)
     code_hscroll.config(command=self.code_text.xview)
     code_vscroll.config(command=self.code_text.yview)
     self.input_file_entry =\
         self.create_and_add_file_field(self.left_frame, "Input file", 5, False)
     self.spherical_coord_option =\
         Radiobutton(self.left_frame, text="Spherical coordinates",
                     variable=self.input_type, value=1)
     self.spherical_coord_option.pack(anchor=Tkinter.W)
     self.cartesian_coord_option =\
         Radiobutton(self.left_frame, text="Cartesian coordinates",
                     variable=self.input_type, value=2)
     self.cartesian_coord_option.pack(anchor=Tkinter.W)
     self.spherical_coord_option.select()
     self.output_file_entry =\
         self.create_and_add_file_field(self.left_frame, "Output file", 5, True)
     self.normalize_check = Checkbutton(self.left_frame,
                                        text="Normalize data",
                                        variable=self.normalize_data,
                                        offvalue=0,
                                        onvalue=1)
     self.normalize_check.pack()
     self.normalize_check.deselect()
     self.do_button = Button(self.left_frame, text="Run", command=self.run)
     self.do_button.pack(side=Tkinter.BOTTOM, pady=(0, 10))
Example #17
0
    def __init__(self):
        root = Tk()
        root.title('FINDME3')
        root.geometry()
        self.root = root
        self.ini = 0
        self.ACC = np.zeros((len(names), ))
        self.trained = [False for i in names]
        self.outliers = [[] for i in names]
        choose = [self._choose(i) for i in range(9)]
        label1 = Label(root, text="input ontology:")
        label2 = Label(root, text="LIMIT:")
        entry1 = Entry(root, bd=5)
        entry2 = Entry(root, bd=3)
        menubar_method = Menu(root, bd=0)
        menusub = Menu(menubar_method, tearoff=0)
        for i in range(len(names)):
            menusub.add_command(label=names[i], command=choose[i])
        menubar_method.add_cascade(label='Method', menu=menusub)
        button1_1 = Button(root, command=self.cin, text='run')
        button1_2 = Button(root, command=self.root.destroy, text='exit')
        button1_3 = Button(root, command=self.available, text='Available')
        button1_4 = Button(root, command=self.train, text='Train&Test')
        button1_5 = Button(root, command=self.listall, text='List all ACC')
        button1_6 = Button(root,
                           command=self.outlier,
                           text='List outliers\n of this method')
        text1 = Text(root,
                     yscrollcommand=True,
                     xscrollcommand=True,
                     wrap='none')
        scr1_1 = Scrollbar(root)
        scr1_2 = Scrollbar(root, orient=HORIZONTAL)
        scr1_1['command'] = text1.yview
        scr1_2['command'] = text1.xview

        text1.configure(yscrollcommand=scr1_1.set, xscrollcommand=scr1_2.set)
        self.configs={'label1':label1\
                      ,'label2':label2\
                      ,'entry1':entry1\
                      ,'entry2':entry2\
                      ,'button1_1':button1_1\
                      ,'button1_2':button1_2\
                      ,'button1_3':button1_3\
                      ,'button1_4':button1_4\
                      ,'button1_5':button1_5\
                      ,'button1_6':button1_6\
                      ,'text1':text1\
                      ,'scr1_1':scr1_1\
                      ,'scr1_2':scr1_2\
                      ,'menu':menubar_method}
        self.display1()
        self.root.config(menu=menubar_method)
Example #18
0
 def add_pane(self):
     master = PanedWindow(bg=BACKGROUND_COLOR)
     master.pack(side=LEFT)
     master.propagate(0)
     canvas = self.get_map().get_canvas()
     hbar = Scrollbar(master, orient=HORIZONTAL)
     hbar.pack(side=BOTTOM, fill=X)
     hbar.config(command=canvas.xview)
     vbar = Scrollbar(master, orient=VERTICAL)
     vbar.pack(side=RIGHT, fill=Y)
     vbar.config(command=canvas.yview)
     canvas.config(xscrollcommand=hbar.set, yscrollcommand=vbar.set)
     canvas.pack(side=LEFT, expand=True, fill=BOTH)
     master.config(width=PANE_W, height=PANE_H)
     master.add(canvas)
Example #19
0
def buscar(pattern, index):
    def listar(event):
        lista.delete(0, END)
        ix = open_dir(index)
        with ix.searcher() as searcher:
            query = QueryParser(pattern,
                                ix.schema).parse(unicode(entrada.get()))
            results = searcher.search(query)
            for r in results:
                lista.insert(END, r['titulo'])
                lista.insert(END, r['fecha'])
                lista.insert(END, r['username'])
                lista.insert(END, '')

    root = Tkinter.Toplevel()
    frame1 = Frame(root)
    entrada = Entry(frame1, bd=2, width=60)
    lab = Label(frame1, text="Buscar: ")

    entrada.bind("<Return>", listar)
    sc = Scrollbar(root)
    sc.pack(side=RIGHT, fill=Y)
    lista = Listbox(root, yscrollcommand=sc.set)
    frame1.pack(side=TOP)

    lista.pack(side=TOP, fill=BOTH)
    lab.pack(side=LEFT)
    entrada.pack(side=LEFT)
    sc.config(command=lista.yview)
    root.mainloop()
Example #20
0
    def _init_readingListbox(self, parent):
        self._readingFrame = listframe = Frame(parent)
        self._readingFrame.pack(fill='both', side='left', padx=2)
        self._readingList_label = Label(self._readingFrame,
                                        font=self._boldfont,
                                        text='Readings')
        self._readingList_label.pack()
        self._readingList = Listbox(self._readingFrame,
                                    selectmode='single',
                                    relief='groove',
                                    background='white',
                                    foreground='#909090',
                                    font=self._font,
                                    selectforeground='#004040',
                                    selectbackground='#c0f0c0')

        self._readingList.pack(side='right', fill='both', expand=1)

        # Add a scrollbar if there are more than 25 examples.
        listscroll = Scrollbar(self._readingFrame, orient='vertical')
        self._readingList.config(yscrollcommand=listscroll.set)
        listscroll.config(command=self._readingList.yview)
        listscroll.pack(side='right', fill='y')

        self._populate_readingListbox()
Example #21
0
 def __init__(self, master, title, dict=None):
     width = 0
     height = 40
     if dict:
         height = 20 * len(
             dict)  # XXX 20 == observed height of Entry widget
     self.master = master
     self.title = title
     import repr
     self.repr = repr.Repr()
     self.repr.maxstring = 60
     self.repr.maxother = 60
     self.frame = frame = Frame(master)
     self.frame.pack(expand=1, fill="both")
     self.label = Label(frame, text=title, borderwidth=2, relief="groove")
     self.label.pack(fill="x")
     self.vbar = vbar = Scrollbar(frame, name="vbar")
     vbar.pack(side="right", fill="y")
     self.canvas = canvas = Canvas(frame,
                                   height=min(300, max(40, height)),
                                   scrollregion=(0, 0, width, height))
     canvas.pack(side="left", fill="both", expand=1)
     vbar["command"] = canvas.yview
     canvas["yscrollcommand"] = vbar.set
     self.subframe = subframe = Frame(canvas)
     self.sfid = canvas.create_window(0, 0, window=subframe, anchor="nw")
     self.load_dict(dict)
    def addListBox(self, ax=600, ay=52, x=0, y=0, bg="#B4045F"):

        scrolly = Scrollbar(self,
                            activebackground="#171212",
                            bg="#171212",
                            orient=VERTICAL,
                            troughcolor="#171212")

        listbox = Listbox(self,
                          height=ay,
                          width=ax,
                          background=bg,
                          borderwidth=0,
                          highlightcolor="#4d86a1",
                          selectbackground="#4d86a1",
                          activestyle=NONE,
                          highlightbackground="#4a4a4a",
                          yscrollcommand=scrolly.set)
        listbox.config(font=("", 10), fg="#FFFFFF")
        listbox.place(x=0, y=0)
        scrolly.place(x=651, y=0, height=387)
        self.__list_listbox.append(listbox)
        self.__list_scrollbar.append(scrolly)
        for x in self.__list_listbox:
            x.configure(yscrollcommand=scrolly.set)
        scrolly.configure(command=self.__yview)
Example #23
0
    def CreateWidgets(self):
        frameText = Frame(self, relief=SUNKEN, height=700)
        frameButtons = Frame(self)
        self.buttonOk = Button(frameButtons,
                               text='Close',
                               command=self.Ok,
                               takefocus=False)
        self.scrollbarView = Scrollbar(frameText,
                                       orient=VERTICAL,
                                       takefocus=False)
        self.textView = Text(frameText,
                             wrap=WORD,
                             fg=self.fg,
                             bg=self.bg,
                             highlightthickness=0)
        self.scrollbarView.config(command=self.textView.yview)
        self.textView.config(yscrollcommand=self.scrollbarView.set)
        self.buttonOk.pack()
        self.scrollbarView.pack(side=RIGHT, fill=Y)
        self.textView.pack(side=LEFT, expand=True, fill=BOTH)
        frameButtons.pack(side=BOTTOM)
        frameText.pack(side=TOP, expand=True, fill=BOTH)

        if TTK:
            frameButtons['style'] = 'RootColor.TFrame'
Example #24
0
    def _init_exampleListbox(self, parent):
        self._exampleFrame = listframe = Frame(parent)
        self._exampleFrame.pack(fill='both', side='left', padx=2)
        self._exampleList_label = Label(self._exampleFrame,
                                        font=self._boldfont,
                                        text='Examples')
        self._exampleList_label.pack()
        self._exampleList = Listbox(self._exampleFrame,
                                    selectmode='single',
                                    relief='groove',
                                    background='white',
                                    foreground='#909090',
                                    font=self._font,
                                    selectforeground='#004040',
                                    selectbackground='#c0f0c0')

        self._exampleList.pack(side='right', fill='both', expand=1)

        for example in self._examples:
            self._exampleList.insert('end', ('  %s' % example))
        self._exampleList.config(height=min(len(self._examples), 25), width=40)

        # Add a scrollbar if there are more than 25 examples.
        if len(self._examples) > 25:
            listscroll = Scrollbar(self._exampleFrame, orient='vertical')
            self._exampleList.config(yscrollcommand=listscroll.set)
            listscroll.config(command=self._exampleList.yview)
            listscroll.pack(side='left', fill='y')

        # If they select a example, apply it.
        self._exampleList.bind('<<ListboxSelect>>', self._exampleList_select)
Example #25
0
    def create_status_controls(self):
        """
        Bottom layout, text status controls for letting the user know what the current state is.
        """
        # Status text for currently selected directory or file.
        self.status_text = StringVar()
        self.status_label = Label(self.top_bottom_frame,
                                  textvariable=self.status_text)
        self.status_text.set(
            'Use controls above to select a source to be modified')
        self.status_label.grid(row=0, column=0)

        # Progress text controls, outputs full logs from libs.
        self.progress_text = Text(self.bottom_frame, height=8, width=60)
        # Add visible scrollbar.
        self.scrollbar = Scrollbar(self.bottom_frame,
                                   command=self.progress_text.yview)
        self.progress_text.configure(yscrollcommand=self.scrollbar.set)
        # Define custom tags for text format.
        self.progress_text.tag_config('bold',
                                      background='black',
                                      foreground='green',
                                      font=('Arial', 12, 'bold'))
        self.progress_text.tag_config('big',
                                      background='black',
                                      foreground='green',
                                      font=('Arial', 20, 'bold'))
        self.progress_text.tag_config('default',
                                      foreground='red',
                                      font=('Courier', 11))
        # Set initial empty text and position.
        self.update_progress_text('')
        self.progress_text.grid(row=0, column=0, sticky='nsew')
        # Add North and South to the scrollbar so it streches in vertical direction.
        self.scrollbar.grid(column=1, row=0, sticky=N + S + W)
Example #26
0
    def __init__(self, master, font):

        self.root = master

        self.Yscroll = Scrollbar(master)
        self.Yscroll.grid(row=1, column=2, sticky='nsew')

        self.height = 7

        self.text = Text(master,
                         padx=5,
                         pady=5,
                         height=10,
                         width=10,
                         bg="Black",
                         fg="White",
                         font=(font, 12),
                         yscrollcommand=self.Yscroll.set)

        self.Yscroll.config(command=self.text.yview)

        self.text.bind("<Key>", lambda e: "break")

        self.text.grid(row=1, column=0, sticky="nsew", columnspan=2)

        self.queue = Queue.Queue()

        self.update()
Example #27
0
 def setup_UI(self):
     # setup tk
     self.root = tk.Tk()
     self.root.title(settings.S_LIST_VERSION)
     self.root.geometry("180x" + str(self.root.winfo_screenheight() - 100) + "-50+20")
     self.root.wm_attributes("-topmost", 1)
     self.root.protocol("WM_DELETE_WINDOW", self.xmlrpc_kill)
     self.customFont = tkFont.Font(family="Helvetica", size=8)
      
     # set up lists
     listframe = Frame(self.root)
     scrollbar = Scrollbar(listframe, orient=tk.VERTICAL)
     self.listbox_numbering = tk.Listbox(listframe, yscrollcommand=scrollbar.set, font=self.customFont)
     self.listbox_content = tk.Listbox(listframe, yscrollcommand=scrollbar.set, font=self.customFont)
     
     h = 52
     lbn_opt = {"height":h, "width":4}
     lbn_opt2 = {"height":h}
      
     scrollbar.config(command=self._scroll_lists)
     scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
     self.listbox_numbering.config(lbn_opt)
     self.listbox_numbering.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)
     self.listbox_content.config(lbn_opt2)
     self.listbox_content.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)
      
     listframe.pack()
Example #28
0
    def __init__(self, parent, scrollbar=True, **kw):

        parent = mx.get_master(parent)
        self.parent = parent

        frame = Frame(parent)
        frame.pack(fill='both', expand=True)

        # text widget
        if "wrap" not in kw:
            kw["wrap"] = "word"
        tk.Text.__init__(self, frame, **kw)
        #self.pack(side='left', fill='both', expand=True)
        mx.AllMixins.__init__(self, parent)

        # scrollbar
        if scrollbar:
            scrb = Scrollbar(frame, orient='vertical', command=self.yview)
            self.config(yscrollcommand=scrb.set)
            scrb.pack(side='right', fill='y')

        # pop-up menu
        self.popup = Menu(self, tearoff=0)
        self.popup.add_command(label='Cut', command=self._cut)
        self.popup.add_command(label='Copy', command=self._copy)
        self.popup.add_command(label='Paste', command=self._paste)
        self.popup.add_separator()
        self.popup.add_command(label='Select All', command=self._select_all)
        self.popup.add_command(label='Clear All', command=self._clear_all)
        self.bind('<Button-3>', self._show_popup)

        # only allow mouse scroll when mouse inside text
        self.bind("<Leave>", lambda event: self.winfo_toplevel().focus_set(),
                  "+")
        self.bind("<Enter>", lambda event: self.focus_set(), "+")
Example #29
0
    def __init__(self, parent, *args, **kw):
        Frame.__init__(self, parent, *args, **kw)
        vscrollbar = Scrollbar(self, orient=VERTICAL)
        vscrollbar.pack(fill=Y, side=RIGHT, expand=FALSE)
        canvas = Canvas(self,
                        bd=0,
                        highlightthickness=0,
                        yscrollcommand=vscrollbar.set)
        canvas.pack(side=LEFT, fill=BOTH, expand=TRUE)
        vscrollbar.config(command=canvas.yview)
        canvas.xview_moveto(0)
        canvas.yview_moveto(0)
        self.interior = interior = Frame(canvas)
        interior_id = canvas.create_window(0, 0, window=interior, anchor=NW)
        self.canv = canvas  # @UndefinedVariable
        self.scroller = vscrollbar

        def _configure_interior(event):
            size = (interior.winfo_reqwidth(), interior.winfo_reqheight())
            canvas.config(scrollregion="0 0 %s %s" % size)
            if interior.winfo_reqwidth() != canvas.winfo_width():
                canvas.config(width=interior.winfo_reqwidth())

        interior.bind('<Configure>', _configure_interior)

        def _configure_canvas(event):
            if interior.winfo_reqwidth() != canvas.winfo_width():
                canvas.itemconfigure(interior_id, width=canvas.winfo_width())

        canvas.bind('<Configure>', _configure_canvas)
Example #30
0
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent

        button_frame = Frame(self)
        button_frame.pack(side=TOP, fill=X, expand=0)
        text_frame = Frame(self)
        text_frame.pack(side=TOP, fill=BOTH, expand=1)

        t = Text(text_frame)
        t.pack(side=LEFT, fill=BOTH, expand=1)
        s = Scrollbar(text_frame)
        s.pack(side=LEFT, fill=Y, expand=1)

        bplay = Button(button_frame, text='Play', command=self.foo)
        bnext = Button(button_frame, text='Next')
        cplot = Checkbutton(button_frame, text="Backplot")
        cmat = Checkbutton(button_frame, text="Material")
        cbit = Checkbutton(button_frame, text="Bit")
        cpause1 = Checkbutton(button_frame, text="Pause after line")
        cpause2 = Checkbutton(button_frame, text="Pause after cmt")

        bplay.pack(side=LEFT)
        bnext.pack(side=LEFT)
        cplot.pack(side=LEFT)
        cmat.pack(side=LEFT)
        cbit.pack(side=LEFT)
        cpause1.pack(side=LEFT)
        cpause2.pack(side=LEFT)