Example #1
2
    def __bookmarks(self, master):
        panel = Frame(master)
        panel.grid_rowconfigure(0, weight=1)

        bookmarks = Frame(panel)
        bookmarks.grid_columnconfigure(0, weight=1)
        bookmarks.grid_rowconfigure(0, weight=1)

        li = Listbox(bookmarks, width=40)
        li.grid(column=0, row=0, sticky=(N, E, S, W))
        self.bookmarks_list = li

        sb = Scrollbar(bookmarks, orient=VERTICAL, command=li.yview)
        sb.grid(column=1, row=0, sticky=(N, S))

        li.config(yscrollcommand=sb.set)
        def _lbox_selected(*args):
            selected_idx = int(li.curselection()[0])
            self.render_start.set(self.bookmarks_values[selected_idx])
            self.canvas.xview_moveto(0)
            if not self.render_auto.get():
                self.update()
        li.bind('<Double-Button-1>', _lbox_selected)
        bookmarks.grid(column=0, row=0, sticky=(N, E, S, W))

        buttons = Frame(panel)
        Button(buttons, image=self.img_start, command=self.start_event).pack(side="left")
        Button(buttons, image=self.img_prev, command=self.prev_event).pack(side="left")
        Button(buttons, image=self.img_end, command=self.end_event).pack(side="right")
        Button(buttons, image=self.img_next, command=self.next_event).pack(side="right")
        buttons.grid(column=0, row=1, sticky=(E, W))

        return panel
Example #2
0
class searchDialog(Toplevel):
        def __init__(self, parent, title):
                self.top = Toplevel(parent)
                self.top.wm_title(title)
                self.top.wm_minsize(width=300, height=400)
                self.top.bind("<Return>", self.searchThreader)
                self.top.bind("<Escape>", self.close)

                self.searchy = Text(self.top)
                self.searchy.config(wrap=WORD)
                self.search_entry = Entry(self.top)
                self.close = Button(self.top, text="Close", command=self.close)
                self.search_button = Button(self.top,
                                            text="Search",
                                            command=self.searchThreader)
                self.scrollbar = Scrollbar(self.top)

                self.scrollbar.pack(side=RIGHT, fill=Y, expand=0)
                self.searchy.config(yscrollcommand=self.scrollbar.set,
                                    state=DISABLED)
                self.searchy.pack(side=TOP, fill=BOTH, expand=1)
                self.search_entry.pack(side=LEFT, fill=X, expand=1)
                self.close.pack(side=RIGHT, fill=BOTH, expand=0)
                self.search_button.pack(side=RIGHT, fill=BOTH, expand=0)

                self.linker = HyperlinkManager(self.searchy)

        def close(self, event=None):
                global SEARCH
                SEARCH = None
                self.top.destroy()

        def putText(self, text):
                updateDisplay(text, self.searchy, self.linker)

        def clearSearch(self):
                self.searchy.config(state=NORMAL)
                self.searchy.delete(1.0, END)
                self.searchy.config(state=DISABLED)

        def searchThreader(self, event=None, text=None):
                self.sear = upThread(6, 'search', (self, text))
                self.sear.start()

        def search(self, toSearch=None):
                if toSearch is None:
                        keyword = self.search_entry.get()
                        self.search_entry.delete(0, END)
                else:
                        keyword = toSearch
                self.clearSearch()
                self.top.wm_title("Search - " + keyword)
                if keyword.split('@')[0] == '':
                        self.putText(
                            API.GetUserTimeline(
                                screen_name=keyword.split('@')[1]
                            )
                        )
                else:
                        self.putText(API.GetSearch(term=keyword))
Example #3
0
    def __init__(self, parent):
        """Construct a DualBox.

        :param parent
        """
        Frame.__init__(self)
        self._select_callback = parent.select_cart

        # make scroll bar
        scroll_bar = Scrollbar(self, orient=Tkinter.VERTICAL, command=self._scroll_bar)

        label1 = Label(self, text=TEXT_LABEL1)
        label2 = Label(self, text=TEXT_LABEL2)

        # make two scroll boxes
        self._list_box1 = Listbox(self, yscrollcommand=scroll_bar.set, exportselection=0, width=40)
        self._list_box2 = Listbox(self, yscrollcommand=scroll_bar.set, exportselection=0, width=40)

        # fill the whole screen - pack!
        scroll_bar.pack(side=Tkinter.RIGHT, fill=Tkinter.Y)

        label1.pack(side=Tkinter.LEFT, fill=Tkinter.X, expand=True)
        self._list_box1.pack(side=Tkinter.LEFT, fill=Tkinter.X, expand=True, padx=5, pady=5)
        self._list_box2.pack(side=Tkinter.LEFT, fill=Tkinter.X, expand=True, padx=5, pady=5)
        label2.pack(side=Tkinter.LEFT, fill=Tkinter.X, expand=True)

        # mouse wheel binding
        self._list_box1.bind("<MouseWheel>", self._scroll_wheel)
        self._list_box2.bind("<MouseWheel>", self._scroll_wheel)

        # onclick binding?
        self._list_box1.bind("<<ListboxSelect>>", self.select)
        self._list_box2.bind("<<ListboxSelect>>", self.select)
Example #4
0
class Logger(LabelFrame):
	def __init__(self, root, *arg):
		LabelFrame.__init__(self, root, *arg, text="Log")
		self.log = Text(self, width=60, height=24, state=DISABLED, wrap=WORD, takefocus="0")
		self.log.grid(row=1, column=1, sticky=N+E+W+S)
		
		self.sblog = Scrollbar(self, command=self.log.yview, orient="vertical")
		self.sblog.grid(column=2, row=1, sticky=N+S+E)
		self.log.config(yscrollcommand=self.sblog.set)
	
	def logMsg(self, s):
		self.logMsgRaw(s+'\n')

	def logMsgRaw(self, s):
		self.log.config(state=NORMAL)
		self.log.insert(END, s)

		try:		
			numlines = int(self.log.index("end - 1 line").split('.')[0]);
		except:
			numlines = 0

		if numlines > MAXLINES:
			self.log.delete("1.0", "%d.0" % (numlines-MAXLINES))			
			
		self.log.config(state=DISABLED)
		self.log.see(END)
Example #5
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=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)

        # 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=NW)

        # track changes to the canvas and frame width and sync them,
        # also updating the scrollbar
        def _configure_interior(event=None):
            # 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=None):
            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())
        canvas.bind('<Configure>', _configure_canvas)
Example #6
0
    def _init_grammar(self, parent):
        # Grammar view.
        self._prodframe = listframe = Frame(parent)
        self._prodframe.pack(fill='both', side='left', padx=2)
        self._prodlist_label = Label(self._prodframe, font=self._boldfont,
                                     text='Available Expansions')
        self._prodlist_label.pack()
        self._prodlist = Listbox(self._prodframe, selectmode='single',
                                 relief='groove', background='white',
                                 foreground='#909090', font=self._font,
                                 selectforeground='#004040',
                                 selectbackground='#c0f0c0')

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

        self._productions = list(self._parser.grammar().productions())
        for production in self._productions:
            self._prodlist.insert('end', ('  %s' % production))
        self._prodlist.config(height=min(len(self._productions), 25))

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

        # If they select a production, apply it.
        self._prodlist.bind('<<ListboxSelect>>', self._prodlist_select)
Example #7
0
    def build_dlg(self):
	top = self.top

	frame = Frame(top)
	frame.pack(side = BOTTOM, fill = X)
	button = UpdatedButton(frame, bitmap = pixmaps.LayerNew, name = 'new',
			       command = self.new_layer)
	button.pack(side = LEFT, fill = BOTH, expand = 1)
	button = UpdatedButton(frame, bitmap = pixmaps.LayerUp, name = 'up',
			       command = self.layer_up)
	button.pack(side = LEFT, fill = BOTH, expand = 1)
	button = UpdatedButton(frame, bitmap = pixmaps.LayerDown,
			       name = 'down', command = self.layer_down)
	button.pack(side = LEFT, fill = BOTH, expand = 1)
	button = UpdatedButton(frame, text = _("Close"), name = 'close',
			       command = self.close_dlg)
	button.pack(side = LEFT, fill = BOTH, expand = 1)

	list_frame = Frame(top)
	list_frame.pack(side = LEFT, expand = 1, fill = BOTH)

	sb_vert = Scrollbar(list_frame, takefocus = 0)
	sb_vert.pack(side = RIGHT, fill = Y)

	self.canvas = canvas = Canvas(list_frame)
	canvas.pack(expand = 1, fill = BOTH)

	self.frame = frame = Frame(canvas, name = 'list')
	canvas.create_window(0, 0, window = frame, anchor = NW)
	sb_vert['command'] = (canvas, 'yview')
	canvas['yscrollcommand'] = (sb_vert, 'set')

	self.active_var = IntVar(top)
Example #8
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 #9
0
    def _init_grammar(self, parent):
        # Grammar view.
        self._prodframe = listframe = Frame(parent)
        self._prodframe.pack(fill="both", side="left", padx=2)
        self._prodlist_label = Label(self._prodframe, font=self._boldfont, text="Available Expansions")
        self._prodlist_label.pack()
        self._prodlist = Listbox(
            self._prodframe,
            selectmode="single",
            relief="groove",
            background="white",
            foreground="#909090",
            font=self._font,
            selectforeground="#004040",
            selectbackground="#c0f0c0",
        )

        self._prodlist.pack(side="right", fill="both", expand=1)

        self._productions = list(self._parser.grammar().productions())
        for production in self._productions:
            self._prodlist.insert("end", ("  %s" % production))
        self._prodlist.config(height=min(len(self._productions), 25))

        # Add a scrollbar if there are more than 25 productions.
        if len(self._productions) > 25:
            listscroll = Scrollbar(self._prodframe, orient="vertical")
            self._prodlist.config(yscrollcommand=listscroll.set)
            listscroll.config(command=self._prodlist.yview)
            listscroll.pack(side="left", fill="y")

        # If they select a production, apply it.
        self._prodlist.bind("<<ListboxSelect>>", self._prodlist_select)
    def __init__(self, parent, controller):
        Frame.__init__(self, parent)
        self.selected = "";
        self.controller = controller
        label = Label(self, text="Select server", font=TITLE_FONT, justify=CENTER, anchor=CENTER)
        label.pack(side="top", fill="x", pady=10)
        
        self.button1 = Button(self, text="Next",state="disabled", command=self.callback_choose)
        button2 = Button(self, text="Refresh", command=self.callback_refresh)        
        button3 = Button(self, text="Back", command=self.callback_start)
        
        scrollbar = Scrollbar(self)
        self.mylist = Listbox(self, width=100, yscrollcommand = scrollbar.set )
        self.mylist.bind("<Double-Button-1>", self.twoClick)

        self.button1.pack()
        button2.pack()
        button3.pack()
        # create list with a scroolbar
        scrollbar.pack( side = "right", fill="y" )
        self.mylist.pack( side = "top", fill = "x", ipadx=20, ipady=20, padx=20, pady=20 )
        scrollbar.config( command = self.mylist.yview )
        # create a progress bar
        label2 = Label(self, text="Refresh progress bar", justify='center', anchor='center')
        label2.pack(side="top", fill="x")
        
        self.bar_lenght = 200
        self.pb = Progressbar(self, length=self.bar_lenght, mode='determinate')
        self.pb.pack(side="top", anchor='center', ipadx=20, ipady=20, padx=10, pady=10)
        self.pb.config(value=0)
Example #11
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 #12
0
    def construct(self):
        status = Frame(self)
        self._update_bar = StatusBar(status)
        self._drawer = MazeCanvas.MazePlannerCanvas(self, self._update_bar, manager=self.manager)
        self._drawer.pack(expand=True,fill=BOTH)
        self._status_bar = StatusBar(status)
        Debug.d_level.set_message_pad(self._status_bar)

        self._status_bar.pack(side=BOTTOM, fill=X)
        self._update_bar.pack(side=BOTTOM, fill=X)

        x_scroll = Scrollbar(self._parent, orient=HORIZONTAL)
        x_scroll.config(command=self._drawer._canvas.xview)
        x_scroll.pack(side=BOTTOM,fill=X)

        y_scroll = Scrollbar(self._parent, orient=VERTICAL)
        y_scroll.config(command=self._drawer._canvas.yview)
        y_scroll.pack(side=RIGHT,fill=Y)

        self._drawer._canvas.config(xscrollcommand=x_scroll.set, yscrollcommand=y_scroll.set,
                                    scrollregion=(-MAX_CANVAS_X, -MAX_CANVAS_Y,
                                                  MAX_CANVAS_X, MAX_CANVAS_Y))
        self._drawer._canvas.bind()

        status.pack(side=BOTTOM, fill=X)
Example #13
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 #14
0
    def initUI(self):
        self.parent.title("Book downloader")
        self.style = Style()
        self.style.theme_use("default")
        
        framesearch = Frame(self)
        framesearch.pack(fill=BOTH)

        search_label = Label(framesearch, text="Filter books:", padx=5, pady=5, width=15)
        search_label.pack(side=LEFT)

        self.search_entry = Entry(framesearch)
        self.search_entry.pack(side=RIGHT, fill=X)
        self.search_entry.bind("<Return>", self.searchHandler)
        #self.search_entry.bind("<Key>", self.searchHandler)
        
        framelist = Frame(self, relief=RAISED, borderwidth=1)
        framelist.pack(fill=BOTH, expand=True)

        self.lb = Listbox(framelist, height=30)
        scrollbar = Scrollbar(framelist)
        scrollbar.pack(side=RIGHT, fill=Y)
        self.lb.config(yscrollcommand=scrollbar.set)
        scrollbar.config(command=self.lb.yview)
        
        self.loadLibrary()
        for b in self.book_list:
            self.lb.insert(END, b[0])
        self.lb.pack(fill=BOTH)
        
        self.pack(fill=BOTH, expand=True)
        
        DownButton = Button(self, text="Download", command=self.downloadAction)
        DownButton.pack(side=RIGHT)
Example #15
0
 def __init__(self, parent, scrollbar=True, **kw):
     
     self.parent = parent
     
     frame = Frame(parent)
     frame.pack(fill='both', expand=True)
     
     # text widget
     Text.__init__(self, frame, **kw)
     self.pack(side='left', fill='both', expand=True)
     
     # 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)
Example #16
0
    def build_dlg(self):
	top = self.top

	button = UpdatedButton(top, text = _("Close"), name = 'close',
				       command = self.close_dlg)
	button.pack(side = BOTTOM, expand = 0, fill = X)
	button = UpdatedButton(top, text = _("Apply"),
			       command = self.apply_style,
			       sensitivecb = self.can_apply)
	button.pack(side = BOTTOM, expand = 0, fill = X)
	self.Subscribe(SELECTION, button.Update)

	button = UpdatedButton(top, text = _("Delete"),
			       command = self.remove_style,
			       sensitivecb = self.can_remove)
	button.pack(side = BOTTOM, expand = 0, fill = X)

	list_frame = Frame(top)
	list_frame.pack(side = TOP, expand = 1, fill = BOTH)

	sb_vert = Scrollbar(list_frame, takefocus = 0)
	sb_vert.pack(side = RIGHT, fill = Y)
	styles = UpdatedListbox(list_frame, name = 'list')
	styles.pack(expand = 1, fill = BOTH)
	styles.Subscribe(COMMAND, self.apply_style)
	sb_vert['command'] = (styles, 'yview')
	styles['yscrollcommand'] = (sb_vert, 'set')
	self.styles = styles
Example #17
0
    def __init__(self, master,x=600,y=200, onLeft=None, onRight=None, **kwargs):
        self.root=master
        self.xsize=x
        self.ysize=y
        self.onLeft=onLeft
        self.onRight=onRight
        self.ratio=100.
        Frame.__init__(self, master,width=x,height=y, **kwargs)
        self.canvas = Canvas(self, width=x, height=y, background="white")
        self.xsb = Scrollbar(self, orient="horizontal", command=self.canvas.xview)
        self.ysb = Scrollbar(self, orient="vertical", command=self.canvas.yview)
        self.canvas.configure(yscrollcommand=self.ysb.set, xscrollcommand=self.xsb.set)
        self.canvas.configure(scrollregion=(0,0,x,y))

        self.xsb.grid(row=1, column=0, sticky="ew")
        self.ysb.grid(row=0, column=1, sticky="ns")
        self.canvas.grid(row=0, column=0, sticky="nsew")
        self.grid_rowconfigure(0, weight=1)
        self.grid_columnconfigure(0, weight=1)

        self.canvas.bind("<Button-1>", self.clickL)
        self.canvas.bind("<Button-3>", self.clickR)

        # This is what enables using the mouse:
        self.canvas.bind("<ButtonPress-1>", self.move_start)
        self.canvas.bind("<B1-Motion>", self.move_move)
        #linux scroll
        self.canvas.bind("<Button-4>", self.zoomerP)
        self.canvas.bind("<Button-5>", self.zoomerM)

        self.canvas.bind_all("<Prior>", self.zoomerP)
        self.canvas.bind_all("<Next>", self.zoomerM)
        self.canvas.bind_all("E", self.zoomExtens)
        #windows scroll
        self.canvas.bind_all("<MouseWheel>",self.zoomer)
Example #18
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 #19
0
 def __init__(self, host, port, queue, thread_client):
     """
     @param host: unicode
     @param port: int
     @param queue: Queue
     """
     # initialization
     self.threaded_client=thread_client
     
     # Constants
     self.TEXT_WIDTH = 150
     self.INPUT_WIDTH = self.TEXT_WIDTH - self.TEXT_WIDTH/3
     
     # Connecting socket
     self.queue = queue
     self.socket = socket(AF_INET, SOCK_STREAM)
     self.socket.connect((host, port))
     
     # Mount widgets
     scrollbar = Scrollbar()
     scrollbar.pack(side=RIGHT, fill=Y)
     self.text = Text(width=self.TEXT_WIDTH, yscrollcommand=scrollbar.set)
     self.text.pack(side=TOP)
     self.input = Entry(width=self.INPUT_WIDTH)
     self.input.pack(side=LEFT)
     self.send = Button(text="Send a message", command=self.send_message)
     self.send.pack(side=LEFT)
     
     self.input.bind("<Return>", self.send_message)
Example #20
0
 def set(self, lo, hi):
     if float(lo) <= 0.0 and float(hi) >= 1.0:
         # grid_remove is currently missing from Tkinter!
         self.tk.call("grid", "remove", self)
     else:
         self.grid()
     Scrollbar.set(self, lo, hi)
    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 #22
0
    def concolefooter(self):
        footerframe = Frame(self.master)
        footerframe.config(padx=5, pady=5, bg=Styles.colours["darkGrey"])
        title = Message(footerframe, text="Console:",
                        justify=CENTER, bg=Styles.colours["darkGrey"],
                        foreground=Styles.colours["yellow"],
                        width=100, font=Styles.fonts["entry"])

        consoletext = Text(footerframe, height=5, width=80, bg=Styles.colours["darkGrey"],
                           foreground=Styles.colours["grey"], state=NORMAL, relief=FLAT, font=Styles.fonts["console"])
        consoletext.insert(END, "Welcome to Project Bi")
        consoletext.config(state=DISABLED)
        self.console.setconsolefield(consoletext)
        scroll = Scrollbar(footerframe, command=consoletext.yview, relief=FLAT)
        consoletext.configure(yscrollcommand=scroll.set)

        self.boptimize = yellowbutton(footerframe, "Optimize", 20, lambda e: self.observerstage())
        deactivatebutton(self.boptimize)
        self.boptimize.pack(side=RIGHT, fill=BOTH, padx=5, pady=5)
        self.boptimize.configure(font=Styles.fonts["h1Button"])

        title.pack(side=LEFT, fill=BOTH)
        scroll.pack(side=LEFT, fill=BOTH)
        consoletext.pack(side=LEFT, fill=BOTH)
        footerframe.grid(row=2, column=0, sticky=W + E + N + S, columnspan=2)

        return footerframe
Example #23
0
class console:

    def __init__(self, master):

        self.Yscroll = Scrollbar(master)
        self.Yscroll.pack(side=RIGHT, fill=Y)        
        
        self.text = Text( master, padx=5, pady=5,
                            height=10,
                            bg="Black", fg="White",
                            font=(DEFAULT_FONT, 12),
                            yscrollcommand=self.Yscroll.set)

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

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

        self.text.pack(fill=BOTH, expand=1)

    def __str__(self):
        """ str(s) -> string """
        return self.text.get()        

    def write(self, string):
        """ Adds string to the bottom of the console """
        self.text.insert( END, string )
        self.text.see(END)
        return

    def read(self):
        """ Returns contents of the console widget """
        return str(self)
Example #24
0
    def __init__(self, root=None):
        self.root = root or Tk()
        self.root.title('Pylint')
        top_frame = Frame(self.root)
        res_frame = Frame(self.root)
        btn_frame = Frame(self.root)
        top_frame.pack(side=TOP, fill=X)
        res_frame.pack(side=TOP, fill=BOTH, expand=True)
        btn_frame.pack(side=TOP, fill=X)
        
        Label(top_frame, text='Module or package').pack(side=LEFT)
        self.txtModule = Entry(top_frame, background='white')
        self.txtModule.bind('<Return>', self.run_lint)
        self.txtModule.pack(side=LEFT, expand=True, fill=X)
        Button(top_frame, text='Run', command=self.run_lint).pack(side=LEFT)

        scrl = Scrollbar(res_frame)
        self.results = Listbox(res_frame,
                               background='white',
                               font='fixedsys',
                               selectmode='browse',
                               yscrollcommand=scrl.set)
        scrl.configure(command=self.results.yview)
        self.results.pack(side=LEFT, expand=True, fill=BOTH)
        scrl.pack(side=RIGHT, fill=Y)
        
        Button(btn_frame, text='Quit', command=self.quit).pack(side=BOTTOM)
        #self.root.bind('<ctrl-q>', self.quit)
        self.txtModule.focus_set()
Example #25
0
File: list.py Project: kd0kfo/todo
    def get_box(self):
        if not self.dialog:
            from Tkinter import Tk,Listbox,Button,Scrollbar,X,Y,BOTTOM,RIGHT,HORIZONTAL,VERTICAL,OptionMenu,StringVar
            self.dialog = Tk()
            self.dialog.title("TODO")
            scrollbar = Scrollbar(self.dialog,orient=HORIZONTAL)
            yscrollbar = Scrollbar(self.dialog,orient=VERTICAL)
            self.todolist = Listbox(self.dialog,width=50,xscrollcommand=scrollbar.set,yscrollcommand=yscrollbar.set)
            scrollbar.config(command=self.todolist.xview)
            scrollbar.pack(side=BOTTOM,fill=X)
            yscrollbar.config(command=self.todolist.yview)
            yscrollbar.pack(side=RIGHT,fill=Y)
            self.todolist.pack(side="left",fill="both",expand=True)
            
            cat_list_name = StringVar()
            cat_list_name.set("Category")
            

            btn = Button(self.dialog,text="Refresh",command=self.refresh_list)
            btn.pack()
            
            self.refresh_list()
            if self.categories:
                self.cat_list = OptionMenu(self.dialog,cat_list_name,*(self.categories+["ALL","NONE"]),command=self.filter_list)
                self.cat_list.pack()
        
        return (self.dialog,self.todolist)
Example #26
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 #27
0
 def __init__(self, list_=None, master=None, title=None):
     '''Must have master, title is optional, li is too.'''
     self.master = master
     if self.master is not None:
         self.top = Toplevel(self.master)
     else:
         return
     self.v = None
     if list_ is None or not isinstance(list_, list):
         self.list = []
     else:
         self.list = list_[:]
     self.top.transient(self.master)
     self.top.grab_set()
     self.top.bind("<Return>", self._choose)
     self.top.bind("<Escape>", self._cancel)
     if title:
         self.top.title(title)
     lf = Frame(self.top)         #Sets up the list.
     lf.pack(side=TOP)
     scroll_bar = Scrollbar(lf)
     scroll_bar.pack(side=RIGHT, fill=Y)
     self.lb = Listbox(lf, selectmode=SINGLE)
     self.lb.pack(side=LEFT, fill=Y)
     scroll_bar.config(command=self.lb.yview)
     self.lb.config(yscrollcommand=scroll_bar.set)
     self.list.sort()
     for item in self.list:
         self.lb.insert(END, item)     #Inserts items into the list.
     bf = Frame(self.top)
     bf.pack(side=BOTTOM)
     Button(bf, text="Select", command=self._choose).pack(side=LEFT)
     Button(bf, text="New", command=self._new).pack(side=LEFT)
     Button(bf, text="Cancel", command=self._cancel).pack(side=LEFT)
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_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 #30
0
class App(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent, background="white")

        self.monitor = SerialMonitor()

        self.parent = parent

        self.frame = Frame(parent, relief=RAISED, borderwidth=1)

        self.scrollbar = Scrollbar(parent)

        self.receive_box = Text(parent, width=10, height=10, takefocus=0)
        self.transmit_box = Text(parent, width=10, height=10, takefocus=0)

        self.send_button = Button(parent, text="Send", command=self.send_message)

        self.initUI()
        self.process_serial_input()
        #self.send_message()


    def initUI(self):
        self.parent.title("Serial Monitor")

        self.frame.pack(fill=BOTH, expand=True)

        self.pack(fill=BOTH, expand=1)

        self.scrollbar.pack(side=RIGHT, fill=Y)

        self.receive_box.pack(side=LEFT)
        self.receive_box.config(yscrollcommand=self.scrollbar.set, state=DISABLED)

        self.transmit_box.pack()

        self.scrollbar.config(command=self.receive_box.yview)

        self.send_button.pack(side=RIGHT, padx=5, pady=5)

    def process_serial_input(self):
        while self.monitor.available():
            try:
                self.receive_box.config(state=NORMAL)
                self.receive_box.insert('end', self.monitor.queue.get())
                self.receive_box.config(state=DISABLED)

            except Queue.Empty:
                pass
        self.after(100, self.process_serial_input)

    def send_message(self):
        message = self.transmit_box.get(1.0, 'end')
        self.monitor.write(message)
Example #31
0
 def __init__(self, parent, filename):
     Frame.__init__(self, parent)
     text = HelpText(self, filename)
     self['background'] = text['background']
     scroll = Scrollbar(self, command=text.yview)
     text['yscrollcommand'] = scroll.set
     self.rowconfigure(0, weight=1)
     self.columnconfigure(1, weight=1)  # text
     self.toc_menu(text).grid(column=0, row=0, sticky='nw')
     text.grid(column=1, row=0, sticky='nsew')
     scroll.grid(column=2, row=0, sticky='ns')
Example #32
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 #33
0
	def showinfo(self):
		infoRecord=LabelFrame(self.window,text='Operation Note')
		infoRecord.place(x=485,y=60)

		sl=Scrollbar(infoRecord)
		sl.pack(side='right',fill='y')
		lb=Listbox(infoRecord,height=25,width=60)
		lb.pack()

		lb['yscrollcommand']=sl.set
		sl['command']=lb.yview

		self.lb=lb
Example #34
0
    def __init__(self, parent):
        Toplevel.__init__(self)
        self.parent = parent
        self.row = 0
        self.maxsize(650, 850)
        self.resizable(0, 0)
        self.scroll = Scrollbar(self)
        self.scroll.pack(side="right", fill="y", expand=True)
        self.frame = Listbox(self, yscrollcommand=self.scroll.set)
        self.scroll.config(command=self.frame.yview)
        self.frame.pack()

        self.init_ui()
Example #35
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 #36
0
class ScrolledList(object):
    # TODO add columns to the Scrolled list:
    #   http://stackoverflow.com/questions/5286093/display-listbox-with-columns-using-tkinter

    def __init__(self, parent_frame):
        self._vsbar = Scrollbar(parent_frame)
        self._hsbar = Scrollbar(parent_frame, orient='horizontal')
        self._list = Listbox(parent_frame, relief=SUNKEN, font=('courier', 12))

        self._vsbar.config(command=self._list.yview, relief=SUNKEN)
        self._hsbar.config(command=self._list.xview, relief=SUNKEN)
        self._list.config(yscrollcommand=self._vsbar.set, relief=SUNKEN)
        self._list.config(xscrollcommand=self._hsbar.set)

        self._vsbar.pack(side=RIGHT, fill=Y)
        self._hsbar.pack(side=BOTTOM, fill=X)
        self._list.pack(side=LEFT, expand=YES, fill=BOTH)
        #self._list.bind('<Double-1>', self.handlelist)

        self._list_pos = 0

    def clear(self):
        self._list.delete(0, END)
        self._list_pos = 0

    def append_list_entry(self, entry_str, fg=None):
        pos = self._list_pos
        self._list_pos += 1
        self._list.insert(END, entry_str)
        if fg:
            self._list.itemconfig(pos, fg=fg)
        return pos

    def highlight_entry(self, entry_index, bg):
        self._list.itemconfig(index=entry_index, bg=bg)
Example #37
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 #38
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 #39
0
 def __init__(self, master=None, **kw):
     self.frame = Frame(master)
     self.vbar = Scrollbar(self.frame)
     self.vbar.pack(side=RIGHT, fill=Y)
     kw.update({'yscrollcommand': self.vbar.set})
     Text.__init__(self, self.frame, **kw)
     self.pack(side=LEFT, fill=BOTH, expand=True)
     self.vbar['command'] = self.yview
     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 #40
0
    def __init__(self, parent):
        """Construct a DualBox.

        :param parent
        """
        Frame.__init__(self)
        self._select_callback = parent.select_cart

        # make scroll bar
        scroll_bar = Scrollbar(self,
                               orient=Tkinter.VERTICAL,
                               command=self._scroll_bar)

        label1 = Label(self, text=TEXT_LABEL1)
        label2 = Label(self, text=TEXT_LABEL2)

        # make two scroll boxes
        self._list_box1 = Listbox(self,
                                  yscrollcommand=scroll_bar.set,
                                  exportselection=0,
                                  width=40)
        self._list_box2 = Listbox(self,
                                  yscrollcommand=scroll_bar.set,
                                  exportselection=0,
                                  width=40)

        # fill the whole screen - pack!
        scroll_bar.pack(side=Tkinter.RIGHT, fill=Tkinter.Y)

        label1.pack(side=Tkinter.LEFT, fill=Tkinter.X, expand=True)
        self._list_box1.pack(side=Tkinter.LEFT,
                             fill=Tkinter.X,
                             expand=True,
                             padx=5,
                             pady=5)
        self._list_box2.pack(side=Tkinter.LEFT,
                             fill=Tkinter.X,
                             expand=True,
                             padx=5,
                             pady=5)
        label2.pack(side=Tkinter.LEFT, fill=Tkinter.X, expand=True)

        # mouse wheel binding
        self._list_box1.bind("<MouseWheel>", self._scroll_wheel)
        self._list_box2.bind("<MouseWheel>", self._scroll_wheel)

        # onclick binding?
        self._list_box1.bind("<<ListboxSelect>>", self.select)
        self._list_box2.bind("<<ListboxSelect>>", self.select)
Example #41
0
    def get_Data():
        Get_data_window = tk.Toplevel()
        Get_data_window.title('查询接口支持的数据集')
        Get_data_window.geometry('300x600')
        Get_data_window.resizable(False, False)

        sl = Scrollbar(Get_data_window)
        sl.pack(side='right', fill='y')
        T = Text(Get_data_window,height=300,width=300)
        T['yscrollcommand'] = sl.set
        T.insert(END,DataSetAre())
        T.pack(side='left')
        sl['command'] = T.yview

        Get_data_window.mainloop()
Example #42
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)
Example #43
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, highlightthickness=0)
     self.textView = Text(frameText, wrap=WORD, highlightthickness=0,
                          fg=self.fg, bg=self.bg)
     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,fill=X)
     frameText.pack(side=TOP,expand=TRUE,fill=BOTH)
Example #44
0
 def __init__(self, master, **options):
     # Create top frame, with scrollbar and listbox
     self.master = master
     self.frame = frame = Frame(master)
     self.frame.pack(fill="both", expand=1)
     self.vbar = vbar = Scrollbar(frame, name="vbar")
     self.vbar.pack(side="right", fill="y")
     self.listbox = listbox = Listbox(frame,
                                      exportselection=0,
                                      background="white")
     if options:
         listbox.configure(options)
     listbox.pack(expand=1, fill="both")
     # Tie listbox and scrollbar together
     vbar["command"] = listbox.yview
     listbox["yscrollcommand"] = vbar.set
     # Bind events to the list box
     listbox.bind("<ButtonRelease-1>", self.click_event)
     listbox.bind("<Double-ButtonRelease-1>", self.double_click_event)
     if macosxSupport.isAquaTk():
         listbox.bind("<ButtonPress-2>", self.popup_event)
         listbox.bind("<Control-Button-1>", self.popup_event)
     else:
         listbox.bind("<ButtonPress-3>", self.popup_event)
     listbox.bind("<Key-Up>", self.up_event)
     listbox.bind("<Key-Down>", self.down_event)
     # Mark as empty
     self.clear()
Example #45
0
    def makeWidgets( self ):
        "Make a label, a text area, and a scroll bar."

        def newTerm( net=self.net, node=self.node, title=self.title ):
            "Pop up a new terminal window for a node."
            net.terms += makeTerms( [ node ], title )
        label = Button( self, text=self.node.name, command=newTerm,
                        **self.buttonStyle )
        label.pack( side='top', fill='x' )
        text = Text( self, wrap='word', **self.textStyle )
        ybar = Scrollbar( self, orient='vertical', width=7,
                          command=text.yview )
        text.configure( yscrollcommand=ybar.set )
        text.pack( side='left', expand=True, fill='both' )
        ybar.pack( side='right', fill='y' )
        return text
Example #46
0
    def __init__(self, parent_frame):
        self._vsbar = Scrollbar(parent_frame)
        self._hsbar = Scrollbar(parent_frame, orient='horizontal')
        self._list = Listbox(parent_frame, relief=SUNKEN, font=('courier', 12))

        self._vsbar.config(command=self._list.yview, relief=SUNKEN)
        self._hsbar.config(command=self._list.xview, relief=SUNKEN)
        self._list.config(yscrollcommand=self._vsbar.set, relief=SUNKEN)
        self._list.config(xscrollcommand=self._hsbar.set)

        self._vsbar.pack(side=RIGHT, fill=Y)
        self._hsbar.pack(side=BOTTOM, fill=X)
        self._list.pack(side=LEFT, expand=YES, fill=BOTH)
        #self._list.bind('<Double-1>', self.handlelist)

        self._list_pos = 0
Example #47
0
    def __init__( self, name, frame, directory, set_callbacks ):
        """Create a group of examples for display and selection.
        
        Params:
        name - the name of this block
        frame - the frame to be attached to.
        codefiles - a list of CodeFile objects to be displayed
        set-callbacks - a tuple of two functions: 
                        both get called when an example is clicked on.
                * The first is passed the text for the example.
                * The second is passed the Codefile object.
        """
        self.name = name
        self.frame = frame
        self.directory = directory

        self.set_text, self.set_active_block = set_callbacks

        self.scrollbar = Scrollbar( self.frame, orient=VERTICAL )

        #self.listbox = Listbox(self.frame, 
        #                       yscrollcommand=self.scrollbar.set, 
        #                       selectmode=BROWSE)
        src_dir = os.path.normpath( __file__ + '../../../' )
        self._draw_tree()
Example #48
0
    def __init__(self, master, font):

        self.app = master
        self.root = master.root

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

        # Create a bar for changing console size
        self.drag = Frame(self.root,
                          bg="white",
                          height=2,
                          cursor="sb_v_double_arrow")

        # Create text bar
        self.height = 10
        self.root_h = self.height + self.app.text.height

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

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

        # Disable all key bindings EXCEPT those with function that return none
        ctrl = "Command" if SYSTEM == MAC_OS else "Control"
        self.text.bind("<Key>", lambda e: "break")
        self.text.bind("<{}-c>".format(ctrl), lambda e: None)

        # Allow for resizing
        self.mouse_down = False
        self.drag.bind("<Button-1>", self.mouseclick)
        self.drag.bind("<ButtonRelease-1>", self.mouserelease)
        self.drag.bind("<B1-Motion>", self.mousedrag)

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

        self.queue = Queue.Queue()
        self.update()
Example #49
0
class ScrolledCanvas:
    def __init__(self, master, **opts):
        if not opts.has_key('yscrollincrement'):
            opts['yscrollincrement'] = 17
        self.master = master
        self.frame = Frame(master)
        self.frame.rowconfigure(0, weight=1)
        self.frame.columnconfigure(0, weight=1)
        self.canvas = Canvas(self.frame, **opts)
        self.canvas.grid(row=0, column=0, sticky="nsew")
        self.vbar = Scrollbar(self.frame, name="vbar")
        self.vbar.grid(row=0, column=1, sticky="nse")
        self.hbar = Scrollbar(self.frame, name="hbar", orient="horizontal")
        self.hbar.grid(row=1, column=0, sticky="ews")
        self.canvas['yscrollcommand'] = self.vbar.set
        self.vbar['command'] = self.canvas.yview
        self.canvas['xscrollcommand'] = self.hbar.set
        self.hbar['command'] = self.canvas.xview
        self.canvas.bind("<Key-Prior>", self.page_up)
        self.canvas.bind("<Key-Next>", self.page_down)
        self.canvas.bind("<Key-Up>", self.unit_up)
        self.canvas.bind("<Key-Down>", self.unit_down)
        #if isinstance(master, Toplevel) or isinstance(master, Tk):
        self.canvas.bind("<Alt-Key-2>", self.zoom_height)
        self.canvas.focus_set()

    def page_up(self, event):
        self.canvas.yview_scroll(-1, "page")
        return "break"

    def page_down(self, event):
        self.canvas.yview_scroll(1, "page")
        return "break"

    def unit_up(self, event):
        self.canvas.yview_scroll(-1, "unit")
        return "break"

    def unit_down(self, event):
        self.canvas.yview_scroll(1, "unit")
        return "break"

    def zoom_height(self, event):
        ZoomHeight.zoom_height(self.master)
        return "break"
Example #50
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 #51
0
    def __init__(self, parent):
        Frame.__init__(self, parent, background="white")

        self.monitor = SerialMonitor()

        self.parent = parent

        self.frame = Frame(parent, relief=RAISED, borderwidth=1)

        self.scrollbar = Scrollbar(parent)

        self.receive_box = Text(parent, width=10, height=10, takefocus=0)
        self.transmit_box = Text(parent, width=10, height=10, takefocus=0)

        self.send_button = Button(parent, text="Send", command=self.send_message)

        self.initUI()
        self.process_serial_input()
Example #52
0
class ApexListContainer(Frame):
    """This is a container for ApexList. Provides some additional buttons
    """
    def __init__(self, parent, apex=None, **kw):
        if apex is None:
            apex = []
        self._apex = apex
        Frame.__init__(self, parent, **kw)
        self._init_components()

    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 #53
0
    def __init__(self, root):
        tk.Frame.__init__(self, root, bg='white')
        self.canvas = tk.Canvas(self)
        #self.canvas.pack(fill="both", expand=1)
        self.canvas.dnd_accept = self.dnd_accept

        self.hbar = Scrollbar(self.canvas, orient=tk.HORIZONTAL)
        self.hbar.pack(side=tk.BOTTOM, fill=tk.X)
        self.hbar.config(command=self.canvas.xview)
        self.vbar = Scrollbar(self.canvas, orient=tk.VERTICAL)
        self.vbar.pack(side=tk.RIGHT, fill=tk.Y)
        self.vbar.config(command=self.canvas.yview)
        self.canvas.config(width=5000, height=5000)
        self.canvas.config(xscrollcommand=self.hbar.set,
                           yscrollcommand=self.vbar.set)
        self.canvas.pack(side=tk.LEFT, expand=True, fill=tk.BOTH)

        self.canvas.bind('<ButtonPress-1>', self.draw_line)
        self.canvas.bind('<ButtonRelease-1>', self.draw_line)
Example #54
0
    def get_Pro():
        Get_Pro_window = tk.Toplevel()
        Get_Pro_window.title('查询所有接口支持省份')
        Get_Pro_window.geometry('230x250')
        Get_Pro_window.resizable(False, False)
        #GP_Text = Message(Get_Pro_window,width=610,text=ProvinceAre()).place(x=0,y=0)
        #ProvinceAre()
        # v = StringVar()
        sl = Scrollbar(Get_Pro_window)
        sl.pack(side='right', fill='y')
        lb = Listbox(Get_Pro_window,height=300,width=230)
        lb['yscrollcommand'] = sl.set
        # v.set(ProvinceAre())
        for item in ProvinceAre():
            lb.insert(END,item)
        lb.pack(side='left')
        sl['command'] = lb.yview

        Get_Pro_window.mainloop()
Example #55
0
    def __init__(self, root=None):

        Frame.__init__(self, root)

        self.textedit = PinguinoTextEdit(self,
                                         borderwidth=0,
                                         relief=FLAT,
                                         highlightthickness=0,
                                         font="mono 11")

        self.linenumber = LineNumber(self,
                                     bg="#afc8e1",
                                     borderwidth=0,
                                     relief=FLAT,
                                     highlightthickness=0)
        self.linenumber.set_editor(self.textedit)
        self.textedit.set_linenumber(self.linenumber)

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

        self.textedit.set_scrolls(xsb, ysb)

        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=RIGHT, fill=BOTH, expand=True)
        self.linenumber.pack(side=LEFT, fill=Y, expand=False)

        Frame(self, bg="#e7e7e7", width=10).pack(side=LEFT, fill=Y)
        Frame(self, bg="#ffffff", width=5).pack(side=LEFT, fill=Y)

        ysb.bind("<B1-Motion>", self.textedit.update_linenumber)
        self.textedit.bind("<B1-Motion>", self.textedit.update_linenumber)
        self.textedit.bind("<Button-4>", self.textedit.update_linenumber)
        self.textedit.bind("<Button-5>", self.textedit.update_linenumber)
        self.textedit.bind("<MouseWheel>", self.textedit.update_linenumber)
Example #56
0
File: UI.py Project: Alovez/Pyste
class PasteUI:
    def __init__(self):
        self.tk = Tk()
        self.pm = PasteManager()
        self.scrollbar = Scrollbar(self.tk)
        self.scrollbar.pack(side=RIGHT, fill=Y)
        self.canvas = Canvas(self.tk, yscrollcommand=self.scrollbar.set)
        self.render_rows()
        self.canvas.config(width=300, height=300)
        self.tk.mainloop()

    def render_rows(self, table='default'):
        rows = self.pm.get_value(table)
        for k, item in rows.iteritems():
            label = Label(self.canvas,
                          text=item,
                          height=10,
                          width=50,
                          wraplength=400,
                          justify='left')
            label.bind(
                "<Button-1>",
                lambda e, item=item, label=label: self.paste(item, label))
            label.bind("<Enter>", lambda e, label=label: self.on_enter(label))
            label.bind("<Leave>", lambda e, label=label: self.on_leave(label))
            label.pack()
        self.scrollbar.config(command=self.canvas.yview)
        self.canvas.pack()

    def paste(self, text, element):
        print text
        pyperclip.copy(text)
        element.config(fg="red")
        element.pack()
        self.tk.destroy()

    def on_enter(self, element):
        element.config(fg="#4f4f4f")
        element.pack()

    def on_leave(self, element):
        element.config(fg="black")
        element.pack()
Example #57
0
    def __init__(self, master):

        self.Yscroll = Scrollbar(master)
        self.Yscroll.pack(side=RIGHT, fill=Y)

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

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

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

        self.text.pack(fill=BOTH, expand=1)
Example #58
0
    def __init__(self, master, font):

        self.Yscroll = Scrollbar(master)
        self.Yscroll.grid(column=1, sticky='nsew')
        self.height = 7

        self.text = Text(master,
                         padx=5,
                         pady=5,
                         height=self.height,
                         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")
Example #59
0
class ScrolledText(Text):
    def __init__(self, master=None, **kw):
        self.frame = Frame(master)
        self.vbar = Scrollbar(self.frame)
        self.vbar.pack(side=RIGHT, fill=Y)

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

        # Copy geometry methods of self.frame -- hack!
        methods = vars(Pack).keys() + vars(Grid).keys() + vars(Place).keys()

        for m in methods:
            if m[0] != '_' and m != 'config' and m != 'configure':
                setattr(self, m, getattr(self.frame, m))

    def __str__(self):
        return str(self.frame)
Example #60
-1
    def startUI(self):

        self.parent.title("Testing")

        self.file_list = listdir(getcwd())

        fileBox = Listbox(self.parent, selectmode=SINGLE)
        fileBox.pack()
        fileBox.grid(column=0, row=1, columnspan=3, rowspan=10, sticky=N + S)

        textBox = Text(self.parent)
        textBox.grid(column=4, row=0, columnspan=4, rowspan=10, sticky=N + S + E)

        ipBox = Entry(self.parent)
        ipBox.grid(column=0, row=0)

        btn = Button(text="Open ->", command=lambda: self.readFile(fileBox, textBox))
        btn.grid(column=3, row=2)

        btnFire = Button(text="Fire away!", command=lambda: self.fireTorpedoes(ipBox, textBox))
        btnFire.grid(column=3, row=3)

        scrlBar = Scrollbar(self.parent, command=textBox.yview)
        scrlBar.grid(column=8, row=0, rowspan=10, sticky=N + S)
        textBox.config(yscrollcommand=scrlBar.set)

        for i in self.file_list:
            fileBox.insert(END, i)