Python tkinter.VERTICAL Examples

The following are 30 code examples of tkinter.VERTICAL(). 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 8 votes vote down vote up
def __init__(self, master):
        super().__init__(master, text="Levels", padding=4)
        self.lowest_level = Player.levelmeter_lowest
        self.pbvar_left = tk.IntVar()
        self.pbvar_right = tk.IntVar()
        pbstyle = ttk.Style()
        # pbstyle.theme_use("classic")  # clam, alt, default, classic
        pbstyle.configure("green.Vertical.TProgressbar", troughcolor="gray", background="light green")
        pbstyle.configure("yellow.Vertical.TProgressbar", troughcolor="gray", background="yellow")
        pbstyle.configure("red.Vertical.TProgressbar", troughcolor="gray", background="orange")

        ttk.Label(self, text="dB").pack(side=tkinter.TOP)
        frame = ttk.LabelFrame(self, text="L.")
        frame.pack(side=tk.LEFT)
        self.pb_left = ttk.Progressbar(frame, orient=tk.VERTICAL, length=200, maximum=-self.lowest_level,
                                       variable=self.pbvar_left, mode='determinate',
                                       style='yellow.Vertical.TProgressbar')
        self.pb_left.pack()

        frame = ttk.LabelFrame(self, text="R.")
        frame.pack(side=tk.LEFT)
        self.pb_right = ttk.Progressbar(frame, orient=tk.VERTICAL, length=200, maximum=-self.lowest_level,
                                        variable=self.pbvar_right, mode='determinate',
                                        style='yellow.Vertical.TProgressbar')
        self.pb_right.pack() 
Example #2
Source File: recipe-578874.py    From code with MIT License 7 votes vote down vote up
def __init__(self, master, factor = 0.5, **kwargs):
        self.__scrollableWidgets = []

        if 'orient' in kwargs:
            if kwargs['orient']== tk.VERTICAL:
                self.__orientLabel = 'y'
            elif kwargs['orient']== tk.HORIZONTAL:
                self.__orientLabel = 'x'
            else:
                raise Exception("Bad 'orient' argument in scrollbar.")
        else:
            self.__orientLabel = 'y'

        kwargs['command'] = self.onScroll
        self.factor = factor

        ttk.Scrollbar.__init__(self, master, **kwargs) 
Example #3
Source File: scroll.py    From hwk-mirror with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, master, initwidget, nmemb, orient=tk.HORIZONTAL, reverse=False, **kwargs):
        assert callable(initwidget)
        super().__init__(master, **kwargs)
        self._interior = tk.Frame(self)
        self.scroller = ScrollingUpdate(self,
                initlist=[initwidget(master=self._interior) for i in range(nmemb)],
                orient=orient,
                reverse=reverse)
        self.scrollbar = tk.Scrollbar(self, orient=orient)
        if orient == tk.HORIZONTAL:
            self.grid_columnconfigure(0, weight=1)
            self._interior.grid(row=0, column=0, sticky="nswe")
            self.scrollbar.grid(row=1, column=0, sticky="nswe")
        elif orient == tk.VERTICAL:
            self.grid_rowconfigure(0, weight=1)
            self._interior.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
            self.scrollbar.pack(side=tk.LEFT, fill=tk.Y)
        self.orient = orient 
Example #4
Source File: timeline.py    From ttkwidgets with GNU General Public License v3.0 6 votes vote down vote up
def configure(self, cnf={}, **kwargs):
        """Update options of the TimeLine widget"""
        kwargs.update(cnf)
        TimeLine.check_kwargs(kwargs)
        scrollbars = 'autohidescrollbars' in kwargs
        for option in self.options:
            attribute = "_" + option
            setattr(self, attribute, kwargs.pop(option, getattr(self, attribute)))
        if scrollbars:
            self._scrollbar_timeline.destroy()
            self._scrollbar_vertical.destroy()
            if self._autohidescrollbars:
                self._scrollbar_timeline = AutoHideScrollbar(self, command=self._set_scroll, orient=tk.HORIZONTAL)
                self._scrollbar_vertical = AutoHideScrollbar(self, command=self._set_scroll_v, orient=tk.VERTICAL)
            else:
                self._scrollbar_timeline = ttk.Scrollbar(self, command=self._set_scroll, orient=tk.HORIZONTAL)
                self._scrollbar_vertical = ttk.Scrollbar(self, command=self._set_scroll_v, orient=tk.VERTICAL)
            self._canvas_scroll.config(xscrollcommand=self._scrollbar_timeline.set,
                                       yscrollcommand=self._scrollbar_vertical.set)
            self._canvas_categories.config(yscrollcommand=self._scrollbar_vertical.set)
            self._scrollbar_timeline.grid(column=1, row=2, padx=(0, 5), pady=(0, 5), sticky="we")
            self._scrollbar_vertical.grid(column=2, row=0, pady=5, padx=(0, 5), sticky="ns")
        ttk.Frame.configure(self, **kwargs)
        self.draw_timeline() 
Example #5
Source File: ui_utils.py    From thonny with MIT License 6 votes vote down vote up
def __init__(self, master):
        ttk.Frame.__init__(self, master)

        # set up scrolling with canvas
        vscrollbar = ttk.Scrollbar(self, orient=tk.VERTICAL)
        self.canvas = tk.Canvas(self, bd=0, highlightthickness=0, yscrollcommand=vscrollbar.set)
        vscrollbar.config(command=self.canvas.yview)
        self.canvas.xview_moveto(0)
        self.canvas.yview_moveto(0)
        self.canvas.grid(row=0, column=0, sticky=tk.NSEW)
        vscrollbar.grid(row=0, column=1, sticky=tk.NSEW)
        self.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1)

        self.interior = ttk.Frame(self.canvas)
        self.interior_id = self.canvas.create_window(0, 0, window=self.interior, anchor=tk.NW)
        self.bind("<Configure>", self._configure_interior, "+")
        self.bind("<Expose>", self._expose, "+") 
Example #6
Source File: SikuliGui.py    From lackey with MIT License 6 votes vote down vote up
def __init__(self, master, textvariable=None, *args, **kwargs):

        tk.Frame.__init__(self, master)
        # Init GUI

        self._y_scrollbar = tk.Scrollbar(self, orient=tk.VERTICAL)

        self._text_widget = tk.Text(self, yscrollcommand=self._y_scrollbar.set, *args, **kwargs)
        self._text_widget.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)

        self._y_scrollbar.config(command=self._text_widget.yview)
        self._y_scrollbar.pack(side=tk.RIGHT, fill=tk.Y)

        if textvariable is not None:
            if not isinstance(textvariable, tk.Variable):
                raise TypeError("tkinter.Variable type expected, {} given.".format(
                    type(textvariable)))
            self._text_variable = textvariable
            self.var_modified()
            self._text_trace = self._text_widget.bind('<<Modified>>', self.text_modified)
            self._var_trace = textvariable.trace("w", self.var_modified) 
Example #7
Source File: views.py    From Python-GUI-Programming-with-Tkinter with MIT License 6 votes vote down vote up
def __init__(self, parent, callbacks, *args, **kwargs):
        super().__init__(parent, *args, **kwargs)
        self.callbacks = callbacks
        self.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1)

        # create treeview
        self.treeview = ttk.Treeview(
            self,
            columns=list(self.column_defs.keys())[1:],
            selectmode='browse'
        )

        # configure scrollbar for the treeview
        self.scrollbar = ttk.Scrollbar(
            self,
            orient=tk.VERTICAL,
            command=self.treeview.yview
        )
        self.treeview.configure(yscrollcommand=self.scrollbar.set)
        self.treeview.grid(row=0, column=0, sticky='NSEW')
        self.scrollbar.grid(row=0, column=1, sticky='NSW')

        # Configure treeview columns
        for name, definition in self.column_defs.items():
            label = definition.get('label', '')
            anchor = definition.get('anchor', self.default_anchor)
            minwidth = definition.get('minwidth', self.default_minwidth)
            width = definition.get('width', self.default_width)
            stretch = definition.get('stretch', False)
            self.treeview.heading(name, text=label, anchor=anchor)
            self.treeview.column(name, anchor=anchor, minwidth=minwidth,
                                 width=width, stretch=stretch)

        self.treeview.bind('<<TreeviewOpen>>', self.on_open_record) 
Example #8
Source File: scroll.py    From hwk-mirror with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, master=None, initlist=None, orient=tk.HORIZONTAL, reverse=False):
        super().__init__(initlist)
        self.offset = 0
        self.show = 5 if initlist is None else len(initlist)
        self.last_list_len = None
        self._reverse = reverse
        if reverse:
           self.skip = -1
        else:
            self.skip = 1

        if orient == tk.HORIZONTAL:
            master.bind_all("<KP_Left>", self.inc_offset if reverse else self.dec_offset)
            master.bind_all("<KP_Right>", self.dec_offset if reverse else self.inc_offset)

        elif orient == tk.VERTICAL:
            master.bind_all("<KP_Up>", self.inc_offset if reverse else self.dec_offset)
            master.bind_all("<KP_Down>", self.dec_offset if reverse else self.inc_offset)
        else:
            raise ValueError
        self.orient = orient 
Example #9
Source File: scroll.py    From hwk-mirror with GNU General Public License v3.0 6 votes vote down vote up
def grid_inner(self, **kwargs):
        if self.orient == tk.HORIZONTAL:
            self._interior.grid_rowconfigure(0, weight=1)
            for i, widget in enumerate(self.scroller):
                self._interior.grid_columnconfigure(i, weight=1)
                widget.grid(row=0, column=i, **kwargs)
            if self.scroller._reverse:
                self._interior.grid_columnconfigure(len(self.scroller)-1, weight=0)
            else:
                self._interior.grid_columnconfigure(0, weight=0)
        elif self.orient == tk.VERTICAL:
            self._interior.grid_columnconfigure(0, weight=1)
            for i, widget in enumerate(self.scroller):
                self._interior.grid_rowconfigure(i, weight=2)
                widget.grid(row=i, column=0, **kwargs)
            # widgets that are first must fully expand
            if self.scroller._reverse:
                self._interior.grid_rowconfigure(len(self.scroller)-1, weight=0)
            else:
                self._interior.grid_rowconfigure(0, weight=0) 
Example #10
Source File: outline.py    From thonny with MIT License 6 votes vote down vote up
def _init_widgets(self):
        # init and place scrollbar
        self.vert_scrollbar = SafeScrollbar(self, orient=tk.VERTICAL)
        self.vert_scrollbar.grid(row=0, column=1, sticky=tk.NSEW)

        # init and place tree
        self.tree = ttk.Treeview(self, yscrollcommand=self.vert_scrollbar.set)
        self.tree.grid(row=0, column=0, sticky=tk.NSEW)
        self.vert_scrollbar["command"] = self.tree.yview

        # set single-cell frame
        self.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1)

        # init tree events
        self.tree.bind("<<TreeviewSelect>>", self._on_select, True)
        self.tree.bind("<Map>", self._update_frame_contents, True)

        # configure the only tree column
        self.tree.column("#0", anchor=tk.W, stretch=True)
        # self.tree.heading('#0', text='Item (type @ line)', anchor=tk.W)
        self.tree["show"] = ("tree",)

        self._class_img = get_workbench().get_image("outline-class")
        self._method_img = get_workbench().get_image("outline-method") 
Example #11
Source File: tkwidgets.py    From hwk-mirror with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, **kwargs):
        super().__init__(parent, highlightthickness=0, **kwargs)
       
        vscrollbar = tk.Scrollbar(self, orient=tk.VERTICAL)
        vscrollbar.pack(side=tk.RIGHT, fill=tk.Y)
      
        self.canvas = canvas = tk.Canvas(self, bd=2, highlightthickness=0,
                        yscrollcommand=vscrollbar.set)
        
        canvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
        vscrollbar.config(command=canvas.yview)
        
        canvas.xview_moveto(0)
        canvas.yview_moveto(0)

        self.interior = interior = tk.Frame(canvas)
        self.interior_id = canvas.create_window(0, 0,
            window=interior,
            anchor=tk.NW)
        
        self.interior.bind("<Configure>", self.configure_interior)
        self.canvas.bind("<Configure>", self.configure_canvas)
        self.scrollbar = vscrollbar
        self.mouse_position = 0 
Example #12
Source File: chapter8_03.py    From Tkinter-GUI-Application-Development-Cookbook with MIT License 6 votes vote down vote up
def __init__(self, path):
        super().__init__()
        self.title("Ttk Treeview")

        columns = ("#1", "#2", "#3")
        self.tree = ttk.Treeview(self, show="headings", columns=columns)
        self.tree.heading("#1", text="Last name")
        self.tree.heading("#2", text="First name")
        self.tree.heading("#3", text="Email")
        ysb = ttk.Scrollbar(self, orient=tk.VERTICAL, command=self.tree.yview)
        self.tree.configure(yscroll=ysb.set)

        with open("contacts.csv", newline="") as f:
            for contact in csv.reader(f):
                self.tree.insert("", tk.END, values=contact)
        self.tree.bind("<<TreeviewSelect>>", self.print_selection)

        self.tree.grid(row=0, column=0)
        ysb.grid(row=0, column=1, sticky=tk.N + tk.S)
        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1) 
Example #13
Source File: chapter8_04.py    From Tkinter-GUI-Application-Development-Cookbook with MIT License 6 votes vote down vote up
def __init__(self, path):
        super().__init__()
        self.title("Ttk Treeview")

        abspath = os.path.abspath(path)
        self.nodes = {}
        self.tree = ttk.Treeview(self)
        self.tree.heading("#0", text=abspath, anchor=tk.W)
        ysb = ttk.Scrollbar(self, orient=tk.VERTICAL,
                            command=self.tree.yview)
        xsb = ttk.Scrollbar(self, orient=tk.HORIZONTAL,
                            command=self.tree.xview)
        self.tree.configure(yscroll=ysb.set, xscroll=xsb.set)

        self.tree.grid(row=0, column=0, sticky=tk.N + tk.S + tk.E + tk.W)
        ysb.grid(row=0, column=1, sticky=tk.N + tk.S)
        xsb.grid(row=1, column=0, sticky=tk.E + tk.W)
        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)

        self.tree.bind("<<TreeviewOpen>>", self.open_node)
        self.populate_node("", abspath) 
Example #14
Source File: chapter2_07.py    From Tkinter-GUI-Application-Development-Cookbook with MIT License 5 votes vote down vote up
def __init__(self):
        super().__init__()
        self.scroll_x = tk.Scrollbar(self, orient=tk.HORIZONTAL)
        self.scroll_y = tk.Scrollbar(self, orient=tk.VERTICAL)
        self.canvas = tk.Canvas(self, width=300, height=100,
                                xscrollcommand=self.scroll_x.set,
                                yscrollcommand=self.scroll_y.set)
        self.scroll_x.config(command=self.canvas.xview)
        self.scroll_y.config(command=self.canvas.yview)

        self.frame = tk.Frame(self.canvas)
        self.btn = tk.Button(self.frame, text="Load image",
                             command=self.load_image)
        self.btn.pack()

        self.canvas.create_window((0, 0), window=self.frame,
                                  anchor=tk.N + tk.W)

        self.canvas.grid(row=0, column=0, sticky="nswe")
        self.scroll_x.grid(row=1, column=0, sticky="we")
        self.scroll_y.grid(row=0, column=1, sticky="ns")

        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)
        self.bind("<Configure>", self.resize)
        self.update_idletasks()
        self.minsize(self.winfo_width(), self.winfo_height()) 
Example #15
Source File: replayer.py    From thonny with MIT License 5 votes vote down vote up
def __init__(self, master):
        ttk.Frame.__init__(self, master)

        self.vbar = ttk.Scrollbar(self, orient=tk.VERTICAL)
        self.vbar.grid(row=0, column=2, sticky=tk.NSEW)
        self.hbar = ttk.Scrollbar(self, orient=tk.HORIZONTAL)
        self.hbar.grid(row=1, column=0, sticky=tk.NSEW, columnspan=2)
        self.text = codeview.SyntaxText(
            self,
            yscrollcommand=self.vbar.set,
            xscrollcommand=self.hbar.set,
            borderwidth=0,
            font="EditorFont",
            wrap=tk.NONE,
            insertwidth=2,
            # selectborderwidth=2,
            inactiveselectbackground="gray",
            # highlightthickness=0, # TODO: try different in Mac and Linux
            # highlightcolor="gray",
            padx=5,
            pady=5,
            undo=True,
            autoseparators=False,
        )

        self.text.grid(row=0, column=1, sticky=tk.NSEW)
        self.hbar["command"] = self.text.xview
        self.vbar["command"] = self.text.yview
        self.columnconfigure(1, weight=1)
        self.rowconfigure(0, weight=1) 
Example #16
Source File: update_gui.py    From Trade-Dangerous with Mozilla Public License 2.0 5 votes vote down vote up
def __init__(self, parent):
        super().__init__(parent)
        self.parent = parent
        
        self.canvas = canvas = tk.Canvas(self, borderwidth=0)
        canvas.grid(row=0, column=0)
        canvas.grid_rowconfigure(0, weight=1)
        canvas.grid_columnconfigure(0, weight=1)
        
        vsb = tk.Scrollbar(parent,
                    orient=tk.VERTICAL,
                    command=canvas.yview)
        vsb.grid(row=0, column=1)
        vsb.pack(side="right", fill=tk.BOTH, expand=False)
        
        canvas.configure(yscrollcommand=vsb.set)
        canvas.configure(yscrollincrement=4)
        
        self.interior = interior = tk.Frame(canvas)
        canvas.create_window(0, 0, window=interior, anchor="nw", tags="interior")
        canvas.bind("<Configure>", self.onConfigure)
        interior.rowconfigure(0, weight=1)
        interior.columnconfigure(0, weight=1)
        interior.columnconfigure(1, weight=1)
        interior.columnconfigure(2, weight=1)
        interior.columnconfigure(3, weight=1)
        interior.columnconfigure(4, weight=1)
        
        canvas.grid(row=0, column=0)
        canvas.pack(side="left", fill=tk.BOTH, expand=True)
        
        self.bind_all("<MouseWheel>", self.onMouseWheel)
        canvas.bind_all("<FocusIn>", self.scrollIntoView)
        
        self.pack(side="left", fill=tk.BOTH, expand=True) 
Example #17
Source File: debugger.py    From thonny with MIT License 5 votes vote down vote up
def _init_layout_widgets(self, master, frame_info):
        self.main_frame = ttk.Frame(
            self
        )  # just a backgroud behind padding of main_pw, without this OS X leaves white border
        self.main_frame.grid(sticky=tk.NSEW)
        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)
        self.main_pw = ui_utils.AutomaticPanedWindow(self.main_frame, orient=tk.VERTICAL)
        self.main_pw.grid(sticky=tk.NSEW, padx=10, pady=10)
        self.main_frame.rowconfigure(0, weight=1)
        self.main_frame.columnconfigure(0, weight=1)

        self._code_book = ttk.Notebook(self.main_pw)
        self._text_frame = CodeView(
            self._code_book, first_line_number=frame_info.firstlineno, font="EditorFont"
        )
        self._code_book.add(self._text_frame, text="Source")
        self.main_pw.add(self._code_book, minsize=200)
        self._code_book.preferred_size_in_pw = 400 
Example #18
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 #19
Source File: preview.py    From faceswap with GNU General Public License v3.0 5 votes vote down vote up
def _build_ui(self):
        """ Build the elements for displaying preview images and options panels. """
        container = tk.PanedWindow(self,
                                   sashrelief=tk.RIDGE,
                                   sashwidth=4,
                                   sashpad=8,
                                   orient=tk.VERTICAL)
        container.pack(fill=tk.BOTH, expand=True)
        container.preview_display = self._display
        self._image_canvas = ImagesCanvas(container, self._tk_vars)
        container.add(self._image_canvas, height=400 * get_config().scaling_factor)

        options_frame = ttk.Frame(container)
        self._cli_frame = ActionFrame(
            options_frame,
            self._available_masks,
            self._samples.predictor.has_predicted_mask,
            self._patch.converter.cli_arguments.color_adjustment.replace("-", "_"),
            self._patch.converter.cli_arguments.mask_type.replace("-", "_"),
            self._patch.converter.cli_arguments.scaling.replace("-", "_"),
            self._config_tools,
            self._refresh,
            self._samples.generate,
            self._tk_vars)
        self._opts_book = OptionsBook(options_frame,
                                      self._config_tools,
                                      self._refresh)
        container.add(options_frame) 
Example #20
Source File: gui.py    From faceswap with GNU General Public License v3.0 5 votes vote down vote up
def add_containers(self):
        """ Add the paned window containers that
            hold each main area of the gui """
        logger.debug("Adding containers")
        maincontainer = tk.PanedWindow(self,
                                       sashrelief=tk.RIDGE,
                                       sashwidth=4,
                                       sashpad=8,
                                       orient=tk.VERTICAL,
                                       name="pw_main")
        maincontainer.pack(fill=tk.BOTH, expand=True)

        topcontainer = tk.PanedWindow(maincontainer,
                                      sashrelief=tk.RIDGE,
                                      sashwidth=4,
                                      sashpad=8,
                                      orient=tk.HORIZONTAL,
                                      name="pw_top")
        maincontainer.add(topcontainer)

        bottomcontainer = ttk.Frame(maincontainer, name="frame_bottom")
        maincontainer.add(bottomcontainer)
        self.objects["container_main"] = maincontainer
        self.objects["container_top"] = topcontainer
        self.objects["container_bottom"] = bottomcontainer

        logger.debug("Added containers") 
Example #21
Source File: main.py    From tkinter-logging-text-widget with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def __init__(self, root):
        self.root = root
        root.title('Logging Handler')
        root.columnconfigure(0, weight=1)
        root.rowconfigure(0, weight=1)
        # Create the panes and frames
        vertical_pane = ttk.PanedWindow(self.root, orient=VERTICAL)
        vertical_pane.grid(row=0, column=0, sticky="nsew")
        horizontal_pane = ttk.PanedWindow(vertical_pane, orient=HORIZONTAL)
        vertical_pane.add(horizontal_pane)
        form_frame = ttk.Labelframe(horizontal_pane, text="MyForm")
        form_frame.columnconfigure(1, weight=1)
        horizontal_pane.add(form_frame, weight=1)
        console_frame = ttk.Labelframe(horizontal_pane, text="Console")
        console_frame.columnconfigure(0, weight=1)
        console_frame.rowconfigure(0, weight=1)
        horizontal_pane.add(console_frame, weight=1)
        third_frame = ttk.Labelframe(vertical_pane, text="Third Frame")
        vertical_pane.add(third_frame, weight=1)
        # Initialize all frames
        self.form = FormUi(form_frame)
        self.console = ConsoleUi(console_frame)
        self.third = ThirdUi(third_frame)
        self.clock = Clock()
        self.clock.start()
        self.root.protocol('WM_DELETE_WINDOW', self.quit)
        self.root.bind('<Control-q>', self.quit)
        signal.signal(signal.SIGINT, self.quit) 
Example #22
Source File: ui_utils.py    From thonny with MIT License 5 votes vote down vote up
def __init__(self, master):
        ttk.Frame.__init__(self, master)

        # set up scrolling with canvas
        vscrollbar = ttk.Scrollbar(self, orient=tk.VERTICAL)
        hscrollbar = ttk.Scrollbar(self, orient=tk.HORIZONTAL)
        self.canvas = tk.Canvas(self, bd=0, highlightthickness=0, yscrollcommand=vscrollbar.set)
        vscrollbar.config(command=self.canvas.yview)
        hscrollbar.config(command=self.canvas.xview)

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

        self.canvas.grid(row=0, column=0, sticky=tk.NSEW)
        vscrollbar.grid(row=0, column=1, sticky=tk.NSEW)
        hscrollbar.grid(row=1, column=0, sticky=tk.NSEW)

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

        self.interior = ttk.Frame(self.canvas)
        self.interior.columnconfigure(0, weight=1)
        self.interior.rowconfigure(0, weight=1)
        self.interior_id = self.canvas.create_window(0, 0, window=self.interior, anchor=tk.NW)
        self.bind("<Configure>", self._configure_interior, "+")
        self.bind("<Expose>", self._expose, "+") 
Example #23
Source File: chapter2_01.py    From Tkinter-GUI-Application-Development-Cookbook with MIT License 5 votes vote down vote up
def __init__(self, master, items=[]):
        super().__init__(master) 
        self.list = tk.Listbox(self)
        self.scroll = tk.Scrollbar(self, orient=tk.VERTICAL,
                                   command=self.list.yview)
        self.list.config(yscrollcommand=self.scroll.set)
        self.list.insert(0, *items)
        self.list.pack(side=tk.LEFT)
        self.scroll.pack(side=tk.LEFT, fill=tk.Y) 
Example #24
Source File: review_filtered_clips.py    From youtube-gesture-dataset with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def make_img_canvas(self):
        self.img_canvas = tk.Canvas(self.img_frame, bg='black')
        self.img_canvas.config(scrollregion=(0, 0, review_img_width, review_img_height))

        hbar = tk.Scrollbar(self.img_frame, orient=tk.HORIZONTAL)
        hbar.pack(side=tk.BOTTOM, fill=tk.X)
        hbar.config(command=self.img_canvas.xview)
        vbar = tk.Scrollbar(self.img_frame, orient=tk.VERTICAL)
        vbar.pack(side=tk.RIGHT, fill=tk.Y)
        vbar.config(command=self.img_canvas.yview)
        self.img_canvas.bind("<MouseWheel>", self._on_mousewheel)

        self.img_canvas.config(xscrollcommand=hbar.set, yscrollcommand=vbar.set)
        self.img_canvas.pack(expand=tk.YES, fill=tk.BOTH) 
Example #25
Source File: replayer.py    From thonny with MIT License 5 votes vote down vote up
def __init__(self):
        super().__init__(get_workbench(), background=lookup_style_option("TFrame", "background"))
        ui_utils.set_zoomed(self, True)

        self.main_pw = ReplayerPanedWindow(self, orient=tk.HORIZONTAL, sashwidth=10)
        self.center_pw = ReplayerPanedWindow(self.main_pw, orient=tk.VERTICAL, sashwidth=10)
        self.right_frame = ttk.Frame(self.main_pw)
        self.right_pw = ReplayerPanedWindow(self.right_frame, orient=tk.VERTICAL, sashwidth=10)
        self.editor_notebook = ReplayerEditorNotebook(self.center_pw)
        shell_book = ttk.Notebook(self.main_pw)
        self.shell = ShellFrame(shell_book)
        self.details_frame = EventDetailsFrame(self.right_pw)
        self.log_frame = LogFrame(
            self.right_pw, self.editor_notebook, self.shell, self.details_frame
        )
        self.browser = ReplayerFileBrowser(self.main_pw, self.log_frame)
        self.control_frame = ControlFrame(self.right_frame)

        self.main_pw.grid(padx=10, pady=10, sticky=tk.NSEW)
        self.main_pw.add(self.browser, width=200)
        self.main_pw.add(self.center_pw, width=1000)
        self.main_pw.add(self.right_frame, width=200)
        self.center_pw.add(self.editor_notebook, height=700)
        self.center_pw.add(shell_book, height=300)
        shell_book.add(self.shell, text="Shell")
        self.right_pw.grid(sticky=tk.NSEW)
        self.control_frame.grid(sticky=tk.NSEW)
        self.right_pw.add(self.log_frame, height=600)
        self.right_pw.add(self.details_frame, height=200)
        self.right_frame.columnconfigure(0, weight=1)
        self.right_frame.rowconfigure(0, weight=1)

        self.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1) 
Example #26
Source File: soundplayer.py    From synthesizer with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, audio_source, master=None):
        self.lowest_level = -50
        self.have_started_playing = False
        super().__init__(master)
        self.master.title("Levels")

        self.pbvar_left = tk.IntVar()
        self.pbvar_right = tk.IntVar()
        pbstyle = ttk.Style()
        pbstyle.theme_use("classic")
        pbstyle.configure("green.Vertical.TProgressbar", troughcolor="gray", background="light green")
        pbstyle.configure("yellow.Vertical.TProgressbar", troughcolor="gray", background="yellow")
        pbstyle.configure("red.Vertical.TProgressbar", troughcolor="gray", background="orange")

        frame = tk.LabelFrame(self, text="Left")
        frame.pack(side=tk.LEFT)
        tk.Label(frame, text="dB").pack()
        self.pb_left = ttk.Progressbar(frame, orient=tk.VERTICAL, length=300,
                                       maximum=-self.lowest_level, variable=self.pbvar_left,
                                       mode='determinate', style='yellow.Vertical.TProgressbar')
        self.pb_left.pack()

        frame = tk.LabelFrame(self, text="Right")
        frame.pack(side=tk.LEFT)
        tk.Label(frame, text="dB").pack()
        self.pb_right = ttk.Progressbar(frame, orient=tk.VERTICAL, length=300,
                                        maximum=-self.lowest_level, variable=self.pbvar_right,
                                        mode='determinate', style='yellow.Vertical.TProgressbar')
        self.pb_right.pack()

        frame = tk.LabelFrame(self, text="Info")
        self.info = tk.Label(frame, text="", justify=tk.LEFT)
        frame.pack()
        self.info.pack(side=tk.TOP)
        self.pack()
        self.open_audio_file(audio_source)
        self.after_idle(self.update)
        self.after_idle(self.stream_audio) 
Example #27
Source File: ui_utils.py    From thonny with MIT License 5 votes vote down vote up
def __init__(
        self,
        master,
        columns,
        displaycolumns="#all",
        show_scrollbar=True,
        show_statusbar=False,
        borderwidth=0,
        relief="flat",
        **tree_kw
    ):
        ttk.Frame.__init__(self, master, borderwidth=borderwidth, relief=relief)
        # http://wiki.tcl.tk/44444#pagetoc50f90d9a
        self.vert_scrollbar = ttk.Scrollbar(
            self, orient=tk.VERTICAL, style=scrollbar_style("Vertical")
        )
        if show_scrollbar:
            self.vert_scrollbar.grid(
                row=0, column=1, sticky=tk.NSEW, rowspan=2 if show_statusbar else 1
            )

        self.tree = ttk.Treeview(
            self,
            columns=columns,
            displaycolumns=displaycolumns,
            yscrollcommand=self.vert_scrollbar.set,
            **tree_kw
        )
        self.tree["show"] = "headings"
        self.tree.grid(row=0, column=0, sticky=tk.NSEW)
        self.vert_scrollbar["command"] = self.tree.yview
        self.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1)
        self.tree.bind("<<TreeviewSelect>>", self.on_select, "+")
        self.tree.bind("<Double-Button-1>", self.on_double_click, "+")

        if show_statusbar:
            self.statusbar = ttk.Frame(self)
            self.statusbar.grid(row=1, column=0, sticky="nswe")
        else:
            self.statusbar = None 
Example #28
Source File: 9.10_chat_client.py    From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License 5 votes vote down vote up
def display_chat_entrybox(self):
        frame = Frame()
        Label(frame, text='Enter chat messages:').pack(side='top', anchor='w')
        self.enter_text_widget = Text(frame, width=60, height=8)
        scrollbar = Scrollbar(
            self.root, command=self.enter_text_widget.yview, orient=VERTICAL)
        self.enter_text_widget.config(yscrollcommand=scrollbar.set)
        self.enter_text_widget.pack(side='left')
        scrollbar.pack(side='right', fill='y')
        self.enter_text_widget.bind('<Return>', self.on_enter_key_pressed)
        frame.pack(side='top') 
Example #29
Source File: 9.10_chat_client.py    From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License 5 votes vote down vote up
def display_chat_transcript(self):
        frame = Frame()
        Label(frame, text='Chat Transcript:').pack(side='top', anchor='w')
        self.chat_transcript_area = Text(frame, width=60, height=20)
        scrollbar = Scrollbar(
            frame, command=self.chat_transcript_area.yview, orient=VERTICAL)
        self.chat_transcript_area.config(yscrollcommand=scrollbar.set)
        self.chat_transcript_area.bind('<KeyPress>', lambda e: 'break')
        self.chat_transcript_area.pack(side='left')
        scrollbar.pack(side='right', fill='y')
        frame.pack(side='top') 
Example #30
Source File: Downloader.py    From proyectoDownloader with MIT License 5 votes vote down vote up
def iniciaTabPL(self):
        ttk.Label(self.tabPL, text="Videos disponibles: ", 
          font=("Arial", 14)).place(x=5,y=10)
        self.listPL = Listbox(self.tabPL, height=10, width=66,
                               font=("Arial", 14), bg='#ABAAAA')
        scrollbar = ttk.Scrollbar(self.tabPL, 
                  command=self.listPL.yview, orient=VERTICAL)
        self.listPL.config(yscrollcommand=scrollbar.set)
        self.listPL.config(selectforeground="#eeeeee",
                            selectbackground="#89C2DE",
                            selectborderwidth=1)
        self.listPL.place(x=6,y=50)
        scrollbar.place(x=723,y=50, height=254)
        self.plbvideo = ttk.Button(self.tabPL, text="Ir a descargar video",
                             command = self.controlador.cargarInfoDesdePL)
        self.plbvideo.place(x=30, y=320)
        
        self.plbbvideo = ttk.Button(self.tabPL, text="Descargar playlist video")
        self.plbbvideo.place(x=250, y=320)

        self.plbbaudio = ttk.Button(self.tabPL, text="Descargar playlist audio")
        self.plbbaudio.place(x=500, y=320)