Python tkinter.NS Examples

The following are 4 code examples of tkinter.NS(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tkinter , or try the search function .
Example #1
Source File: box.py    From synthesizer with GNU Lesser General Public License v3.0 6 votes vote down vote up
def __init__(self, app, master):
        super().__init__(master, text="Playlist", padding=4)
        self.app = app
        bf = ttk.Frame(self)
        ttk.Button(bf, text="Move to Top", width=11, command=self.do_to_top).pack()
        ttk.Button(bf, text="Move Up", width=11, command=self.do_move_up).pack()
        ttk.Button(bf, text="Move Down", width=11, command=self.do_move_down).pack()
        ttk.Button(bf, text="Remove", width=11, command=self.do_remove).pack()
        bf.pack(side=tk.LEFT, padx=4)
        sf = ttk.Frame(self)
        cols = [("title", 300), ("artist", 180), ("album", 180), ("length", 80)]
        self.listTree = ttk.Treeview(sf, columns=[col for col, _ in cols], height=10, show="headings")
        vsb = ttk.Scrollbar(orient="vertical", command=self.listTree.yview)
        self.listTree.configure(yscrollcommand=vsb.set)
        self.listTree.grid(column=1, row=0, sticky=tk.NSEW, in_=sf)
        vsb.grid(column=0, row=0, sticky=tk.NS, in_=sf)
        for col, colwidth in cols:
            self.listTree.heading(col, text=col.title())
            self.listTree.column(col, width=colwidth)
        sf.grid_columnconfigure(0, weight=1)
        sf.grid_rowconfigure(0, weight=1)
        sf.pack(side=tk.LEFT, padx=4) 
Example #2
Source File: recipe-577637.py    From code with MIT License 5 votes vote down vote up
def __init__(self, master):
        super().__init__(master)
        # Get the username and save list of found files.
        self.__user = getpass.getuser()
        self.__dirlist = set()
        # Create widgets.
        self.__log = tkinter.Text(self)
        self.__bar = tkinter.ttk.Scrollbar(self, orient=tkinter.VERTICAL,
                                           command=self.__log.yview)
        self.__ent = tkinter.ttk.Entry(self, cursor='xterm')
        # Configure widgets.
        self.__log.configure(state=tkinter.DISABLED, wrap=tkinter.WORD,
                             yscrollcommand=self.__bar.set)
        # Create binding.
        self.__ent.bind('<Return>', self.create_message)
        # Position widgets.
        self.__log.grid(row=0, column=0, sticky=tkinter.NSEW)
        self.__bar.grid(row=0, column=1, sticky=tkinter.NS)
        self.__ent.grid(row=1, column=0, columnspan=2, sticky=tkinter.EW)
        # Configure resizing.
        self.grid_rowconfigure(0, weight=1)
        self.grid_columnconfigure(0, weight=1)
        # Focus entry.
        self.__ent.focus_set()
        # Schedule message discovery.
        self.after_idle(self.get_messages) 
Example #3
Source File: box.py    From synthesizer with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, app, master):
        super().__init__(master, text="Search song", padding=4)
        self.app = app
        self.search_text = tk.StringVar()
        self.filter_choice = tk.StringVar(value="title")
        bf = ttk.Frame(self)
        ttk.Label(bf, text="Search for:").pack()
        e = ttk.Entry(bf, textvariable=self.search_text)
        e.bind("<Return>", self.do_search)
        e.bind("<KeyRelease>", self.on_key_up)
        self.search_job = None
        e.pack()
        ttk.Radiobutton(bf, text="title", value="title", variable=self.filter_choice, width=10).pack()
        ttk.Radiobutton(bf, text="artist", value="artist", variable=self.filter_choice, width=10).pack()
        ttk.Radiobutton(bf, text="album", value="album", variable=self.filter_choice, width=10).pack()
        ttk.Radiobutton(bf, text="year", value="year", variable=self.filter_choice, width=10).pack()
        ttk.Radiobutton(bf, text="genre", value="genre", variable=self.filter_choice, width=10).pack()
        ttk.Button(bf, text="Search", command=self.do_search).pack()
        ttk.Button(bf, text="Add all selected", command=self.do_add_selected).pack()
        bf.pack(side=tk.LEFT)
        sf = ttk.Frame(self)
        cols = [("title", 320), ("artist", 200), ("album", 200), ("year", 60), ("genre", 160), ("length", 80)]
        self.resultTreeView = ttk.Treeview(sf, columns=[col for col, _ in cols], height=16, show="headings")
        vsb = ttk.Scrollbar(orient="vertical", command=self.resultTreeView.yview)
        self.resultTreeView.configure(yscrollcommand=vsb.set)
        self.resultTreeView.grid(column=1, row=0, sticky=tk.NSEW, in_=sf)
        vsb.grid(column=0, row=0, sticky=tk.NS, in_=sf)
        for col, colwidth in cols:
            self.resultTreeView.heading(col, text=col.title(), command=lambda c=col: self.sortby(self.resultTreeView, c, 0))
            self.resultTreeView.column(col, width=colwidth)
        self.resultTreeView.bind("<Double-1>", self.on_doubleclick)
        sf.grid_columnconfigure(0, weight=1)
        sf.grid_rowconfigure(0, weight=1)
        sf.pack(side=tk.LEFT, padx=4) 
Example #4
Source File: gui_widgets.py    From SVPV with MIT License 4 votes vote down vote up
def __init__(self, parent, header, width=10, selectmode=tk.BROWSE):
        tk.Frame.__init__(self, parent)
        self.parent = parent
        self.num_f = len(header)
        self.headers = []
        self.lbs = []
        self.c = 0
        self.sel_idxs = []

        self.scroll = tk.Scrollbar(self, orient=tk.VERTICAL)
        for i in range(0, self.num_f):
            self.headers.append(tk.Label(self, text=header[i]))
            self.headers[-1].grid(row=0, column=self.c, sticky=tk.EW)
            self.lbs.append(tk.Listbox(self, width=width, selectmode=selectmode, yscrollcommand=self.yscroll, bg='white'))
            self.lbs[-1].grid(row=1, column=self.c, sticky=tk.EW)
            self.lbs[-1].bind("<<ListboxSelect>>", self.select)
            self.c += 1

        self.scroll.config(command=self.lbs[0].yview)
        self.scroll.grid(row=1, column=self.c, sticky=tk.NS)