Python tkinter.Y Examples

The following are 30 code examples of tkinter.Y(). 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: friendslist.py    From Tkinter-GUI-Programming-by-Example with MIT License 6 votes vote down vote up
def show_friends(self):
        self.configure(menu=self.menu)
        self.login_frame.pack_forget()

        self.canvas = tk.Canvas(self, bg="white")
        self.canvas_frame = tk.Frame(self.canvas)

        self.scrollbar = ttk.Scrollbar(self, orient="vertical", command=self.canvas.yview)
        self.canvas.configure(yscrollcommand=self.scrollbar.set)

        self.scrollbar.pack(side=tk.LEFT, fill=tk.Y)
        self.canvas.pack(side=tk.LEFT, expand=1, fill=tk.BOTH)

        self.friends_area = self.canvas.create_window((0, 0), window=self.canvas_frame, anchor="nw")

        self.bind_events()

        self.load_friends() 
Example #2
Source File: menotexport-gui.py    From Menotexport with GNU General Public License v3.0 6 votes vote down vote up
def addMessageFrame(self):
        frame=Frame(self)
        frame.pack(fill=tk.BOTH,side=tk.TOP,\
                expand=1,padx=8,pady=5)

        self.messagelabel=tk.Label(frame,text='Message',bg='#bbb')
        self.messagelabel.pack(side=tk.TOP,fill=tk.X)

        self.text=tk.Text(frame)
        self.text.pack(side=tk.TOP,fill=tk.BOTH,expand=1)
        self.text.height=10

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

        self.text.config(yscrollcommand=scrollbar.set)
        scrollbar.config(command=self.text.yview) 
Example #3
Source File: gui_mgr.py    From plex-mpv-shim with MIT License 6 votes vote down vote up
def run(self):
        root = tk.Tk()
        self.root = root
        root.title("Application Log")
        text = tk.Text(root)
        text.pack(side=tk.LEFT, fill=tk.BOTH, expand = tk.YES)
        text.config(wrap=tk.WORD)
        self.text = text
        yscroll = tk.Scrollbar(command=text.yview)
        text['yscrollcommand'] = yscroll.set
        yscroll.pack(side=tk.RIGHT, fill=tk.Y)
        text.config(state=tk.DISABLED)
        self.update()
        root.mainloop()
        self.r_queue.put(("die", None))

# Q: OK. So you put Tkinter in it's own process.
#    Now why is Pystray in another process too?!
# A: Because if I don't, MPV and GNOME Appindicator
#    try to access the same resources and cause the
#    entire application to segfault.
#
# I suppose this means I can put the Tkinter GUI back
# into the main process. This is true, but then the
# two need to be merged, which is non-trivial. 
Example #4
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 #5
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 #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: texteditor.py    From Tkinter-GUI-Programming-by-Example with MIT License 6 votes vote down vote up
def __init__(self):
        super().__init__()

        self.text_area = TextArea(self, bg="white", fg="black", undo=True)

        self.scrollbar = ttk.Scrollbar(orient="vertical", command=self.scroll_text)
        self.text_area.configure(yscrollcommand=self.scrollbar.set)

        self.line_numbers = LineNumbers(self, self.text_area, bg="grey", fg="white", width=1)
        self.highlighter = Highlighter(self.text_area, 'languages/python.yaml')

        self.scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
        self.line_numbers.pack(side=tk.LEFT, fill=tk.Y)
        self.text_area.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)

        self.bind_events() 
Example #8
Source File: friendslist.py    From Tkinter-GUI-Programming-by-Example with MIT License 6 votes vote down vote up
def __init__(self, **kwargs):
        super().__init__(**kwargs)

        self.title('Tk Chat')
        self.geometry('700x500')

        self.menu = tk.Menu(self, bg="lightgrey", fg="black", tearoff=0)

        self.friends_menu = tk.Menu(self.menu, fg="black", bg="lightgrey", tearoff=0)
        self.friends_menu.add_command(label="Add Friend", command=self.add_friend)

        self.menu.add_cascade(label="Friends", menu=self.friends_menu)

        self.configure(menu=self.menu)

        self.canvas = tk.Canvas(self, bg="white")
        self.canvas_frame = tk.Frame(self.canvas)

        self.scrollbar = ttk.Scrollbar(self, orient="vertical", command=self.canvas.yview)
        self.canvas.configure(yscrollcommand=self.scrollbar.set)

        self.scrollbar.pack(side=tk.LEFT, fill=tk.Y)
        self.canvas.pack(side=tk.LEFT, expand=1, fill=tk.BOTH)

        self.friends_area = self.canvas.create_window((0, 0), window=self.canvas_frame, anchor="nw")

        self.bind_events()

        self.load_friends() 
Example #9
Source File: friendslist.py    From Tkinter-GUI-Programming-by-Example with MIT License 6 votes vote down vote up
def show_friends(self):
        self.configure(menu=self.menu)
        self.login_frame.pack_forget()

        self.canvas = tk.Canvas(self, bg="white")
        self.canvas_frame = tk.Frame(self.canvas)

        self.scrollbar = ttk.Scrollbar(self, orient="vertical", command=self.canvas.yview)
        self.canvas.configure(yscrollcommand=self.scrollbar.set)

        self.scrollbar.pack(side=tk.LEFT, fill=tk.Y)
        self.canvas.pack(side=tk.LEFT, expand=1, fill=tk.BOTH)

        self.friends_area = self.canvas.create_window((0, 0), window=self.canvas_frame, anchor="nw")

        self.bind_events()

        self.load_friends() 
Example #10
Source File: preview.py    From faceswap with GNU General Public License v3.0 5 votes vote down vote up
def _header_text(self):
        """ Create the header text displaying the frame name for each preview column.

        Returns
        -------
        :class:`numpy.ndarray`
            The header row of the preview image containing the frame names for each column
        """
        font_scale = self._size / 640
        height = self._size // 8
        font = cv2.FONT_HERSHEY_SIMPLEX
        # Get size of placed text for positioning
        text_sizes = [cv2.getTextSize(self._faces["filenames"][idx],
                                      font,
                                      font_scale,
                                      1)[0]
                      for idx in range(self._total_columns)]
        # Get X and Y co-ordinates for each text item
        text_y = int((height + text_sizes[0][1]) / 2)
        text_x = [int((self._size - text_sizes[idx][0]) / 2) + self._size * idx
                  for idx in range(self._total_columns)]
        logger.debug("filenames: %s, text_sizes: %s, text_x: %s, text_y: %s",
                     self._faces["filenames"], text_sizes, text_x, text_y)
        header_box = np.ones((height, self._size * self._total_columns, 3), np.uint8) * 255
        for idx, text in enumerate(self._faces["filenames"]):
            cv2.putText(header_box,
                        text,
                        (text_x[idx], text_y),
                        font,
                        font_scale,
                        (0, 0, 0),
                        1,
                        lineType=cv2.LINE_AA)
        logger.debug("header_box.shape: %s", header_box.shape)
        return header_box 
Example #11
Source File: scrollable_frame_gui.py    From pyDEA with MIT License 5 votes vote down vote up
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)
            self.canvas = canvas = StyledCanvas(
                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=N+W)

            # track changes to the canvas and frame width and sync them,
            # also updating the scrollbar
            def _configure_interior(event):
                # update the scrollbars to match the size of the inner frame
                size = (interior.winfo_reqwidth(), interior.winfo_reqheight())
                canvas.config(scrollregion="0 0 %s %s" % size)
                if interior.winfo_reqwidth() != canvas.winfo_width():
                    # update the canvas's width to fit the inner frame
                    canvas.config(width=interior.winfo_reqwidth())
            interior.bind('<Configure>', _configure_interior)

            def _configure_canvas(event):
                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)
            MouseWheel(self).add_scrolling(canvas, yscrollbar=vscrollbar) 
Example #12
Source File: run_gui.py    From margipose with Apache License 2.0 5 votes vote down vote up
def _make_global_toolbar(self, master):
        toolbar = tk.Frame(master, bd=1, relief=tk.RAISED)

        def add_label(text):
            opts = dict(text=text) if isinstance(text, str) else dict(textvariable=text)
            label = tk.Label(toolbar, **opts)
            label.pack(side=tk.LEFT, fill=tk.Y, padx=2, pady=2)
            return label

        add_label('Example index:')
        txt_cur_example = tk.Spinbox(
            toolbar, textvariable=self.var_cur_example, command=self.on_change_example,
            wrap=True, from_=0, to=len(self.dataset) - 1, font=tk.font.Font(size=12))
        def on_key_cur_example(event):
            if event.keysym == 'Return':
                self.on_change_example()
        txt_cur_example.bind('<Key>', on_key_cur_example)
        txt_cur_example.pack(side=tk.LEFT, fill=tk.Y, padx=2, pady=2)

        if self.model is not None:
            add_label('MPJPE:')
            add_label(self.var_mpjpe)
            add_label('PCK@150mm:')
            add_label(self.var_pck)

            chk_aligned = tk.Checkbutton(
                toolbar, text='Procrustes alignment', variable=self.var_aligned,
                command=lambda: self.update_current_tab())
            chk_aligned.pack(side=tk.LEFT, fill=tk.Y, padx=2, pady=2)

        return toolbar 
Example #13
Source File: box.py    From synthesizer with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self):
        super().__init__()
        self.config_location = appdirs.user_data_dir("PythonJukebox", "Razorvine")
        os.makedirs(self.config_location, mode=0o700, exist_ok=True)
        for family in tk.font.names():
            font = tk.font.nametofont(family)
            font["size"] = abs(font["size"]) + 1
            if family != "TkFixedFont":
                font["family"] = "helvetica"
        self.title("Jukebox   |   synthplayer lib v" + synthplayer.__version__)
        f = ttk.Frame()
        f1 = ttk.Frame(f)
        self.firstTrackFrame = TrackFrame(f1, "Track 1")
        self.secondTrackFrame = TrackFrame(f1, "Track 2")
        self.levelmeterFrame = LevelmeterFrame(f1)
        self.playlistFrame = PlaylistFrame(self, f1)
        self.firstTrackFrame.pack(side=tk.LEFT, fill=tk.Y)
        self.secondTrackFrame.pack(side=tk.LEFT, fill=tk.Y)
        self.levelmeterFrame.pack(side=tk.LEFT, fill=tk.Y)
        self.playlistFrame.pack(side=tk.LEFT, fill=tk.Y)
        f1.pack(side=tk.TOP)
        f2 = ttk.Frame(f)
        self.searchFrame = SearchFrame(self, f2)
        self.searchFrame.pack()
        f2.pack(side=tk.TOP)
        f3 = ttk.Frame(f)
        optionsFrame = ttk.Frame(f3)
        ttk.Button(optionsFrame, text="Database Config", command=self.do_database_config).pack()
        optionsFrame.pack(side=tk.LEFT)
        self.effectsFrame = EffectsFrame(self, f3)
        self.effectsFrame.pack()
        f3.pack(side=tk.TOP)
        self.statusbar = ttk.Label(f, text="<status>", relief=tk.GROOVE, anchor=tk.CENTER)
        self.statusbar.pack(fill=tk.X, expand=True)
        f.pack()
        self.player = Player(self, (self.firstTrackFrame, self.secondTrackFrame))
        self.backend = None
        self.backend_process = None
        self.show_status("Connecting to backend file service...")
        self.after(500, self.connect_backend) 
Example #14
Source File: app.py    From captcha_trainer with Apache License 2.0 5 votes vote down vote up
def listbox_scrollbar(listbox: tk.Listbox):
        y_scrollbar = tk.Scrollbar(
            listbox, command=listbox.yview
        )
        y_scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
        listbox.config(yscrollcommand=y_scrollbar.set) 
Example #15
Source File: base.py    From guizero with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _pack_widget(self, widget):
        pack_params={}

        if widget.width == "fill" and widget.height == "fill":
            pack_params["fill"] = BOTH
            pack_params["expand"] = YES
        elif widget.width == "fill":
            pack_params["fill"] = X
        elif widget.height == "fill":
            pack_params["fill"] = Y

        if widget.align is not None:
            pack_params["side"] = widget.align

        # this is to cater for scenario's where the frame will not expand to fill the container
        # if aligned - tk weirdness.
        if pack_params.get("side") is None and pack_params.get("fill") == Y:
            pack_params["expand"] = YES

        if pack_params.get("side") in ["top", "bottom"] and pack_params.get("fill") == Y:
            pack_params["expand"] = YES

        if pack_params.get("side") in ["left", "right"] and pack_params.get("fill") == X:
            pack_params["expand"] = YES

        widget.tk.pack(**pack_params) 
Example #16
Source File: menu.py    From faceswap with GNU General Public License v3.0 5 votes vote down vote up
def _group_separator(self):
        separator = ttk.Separator(self._btn_frame, orient="vertical")
        separator.pack(padx=(2, 1), fill=tk.Y, side=tk.LEFT) 
Example #17
Source File: control_helper.py    From faceswap with GNU General Public License v3.0 5 votes vote down vote up
def add_scrollbar(self):
        """ Add a scrollbar to the options frame """
        logger.debug("Add Config Scrollbar")
        scrollbar = ttk.Scrollbar(self, command=self._canvas.yview)
        scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
        self._canvas.config(yscrollcommand=scrollbar.set)
        self.mainframe.bind("<Configure>", self.update_scrollbar)
        logger.debug("Added Config Scrollbar") 
Example #18
Source File: display_analysis.py    From faceswap with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, selected_id, helptext):
        logger.debug("Initializing: %s: (parent, %s, selected_id: %s, helptext: '%s')",
                     self.__class__.__name__, parent, selected_id, helptext)
        super().__init__(parent)
        self.pack(side=tk.TOP, padx=5, pady=5, fill=tk.BOTH, expand=True)
        self.session = None  # set when loading or clearing from parent
        self.thread = None  # Thread for loading data popup
        self.selected_id = selected_id
        self.popup_positions = list()

        self.canvas = tk.Canvas(self, bd=0, highlightthickness=0)
        self.canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)

        self.tree_frame = ttk.Frame(self.canvas)
        self.tree_canvas = self.canvas.create_window((0, 0), window=self.tree_frame, anchor=tk.NW)
        self.sub_frame = ttk.Frame(self.tree_frame)
        self.sub_frame.pack(side=tk.LEFT, fill=tk.X, anchor=tk.N, expand=True)

        self.add_label()
        self.tree = ttk.Treeview(self.sub_frame, height=1, selectmode=tk.BROWSE)
        self.scrollbar = ttk.Scrollbar(self.tree_frame, orient="vertical", command=self.tree.yview)
        self.scrollbar.pack(side=tk.RIGHT, fill=tk.Y)

        self.columns = self.tree_configure(helptext)
        self.canvas.bind("<Configure>", self.resize_frame)
        logger.debug("Initialized: %s", self.__class__.__name__) 
Example #19
Source File: display_analysis.py    From faceswap with GNU General Public License v3.0 5 votes vote down vote up
def layout_frames(self):
        """ Top level container frames """
        logger.debug("Layout frames")
        leftframe = ttk.Frame(self)
        leftframe.pack(side=tk.LEFT, expand=False, fill=tk.BOTH, pady=5)

        sep = ttk.Frame(self, width=2, relief=tk.RIDGE)
        sep.pack(fill=tk.Y, side=tk.LEFT)

        self.graph_frame = ttk.Frame(self)
        self.graph_frame.pack(side=tk.RIGHT, fill=tk.BOTH, pady=5, expand=True)
        logger.debug("Laid out frames")

        return leftframe 
Example #20
Source File: reddit.py    From Social-Amnesia with GNU General Public License v3.0 5 votes vote down vote up
def build_window(root, window, title_text):
    def onFrameConfigure(canvas):
        '''Reset the scroll region to encompass the inner frame'''
        canvas.configure(scrollregion=canvas.bbox('all'))

    canvas = tk.Canvas(window, width=750, height=1000)
    frame = tk.Frame(canvas)

    scrollbar = tk.Scrollbar(window, command=canvas.yview)
    canvas.configure(yscrollcommand=scrollbar.set)

    scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
    canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
    canvas.create_window((4, 4), window=frame, anchor="nw")

    title_label = tk.Label(
        frame, text=title_text, font=('arial', 30))

    frame.bind("<Configure>", lambda event,
               canvas=canvas: onFrameConfigure(canvas))

    title_label.grid(
        row=0, column=0, columnspan=2, sticky='w')

    ttk.Separator(frame, orient=tk.HORIZONTAL).grid(
        row=2, columnspan=2, sticky='ew', pady=5)

    return frame 
Example #21
Source File: contacts_view.py    From Tkinter-GUI-Application-Development-Cookbook with MIT License 5 votes vote down vote up
def __init__(self, master, **kwargs):
        super().__init__(master)
        self.lb = tk.Listbox(self, **kwargs)
        scroll = tk.Scrollbar(self, command=self.lb.yview)

        self.lb.config(yscrollcommand=scroll.set)
        scroll.pack(side=tk.RIGHT, fill=tk.Y)
        self.lb.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) 
Example #22
Source File: chapter5_02.py    From Tkinter-GUI-Application-Development-Cookbook with MIT License 5 votes vote down vote up
def __init__(self, master, **kwargs):
        super().__init__(master)
        self.lb = tk.Listbox(self, **kwargs)
        scroll = tk.Scrollbar(self, command=self.lb.yview)

        self.lb.config(yscrollcommand=scroll.set)
        scroll.pack(side=tk.RIGHT, fill=tk.Y)
        self.lb.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) 
Example #23
Source File: twitter.py    From Social-Amnesia with GNU General Public License v3.0 5 votes vote down vote up
def build_window(root, window, title_text):
    def onFrameConfigure(canvas):
        '''Reset the scroll region to encompass the inner frame'''
        canvas.configure(scrollregion=canvas.bbox('all'))

    canvas = tk.Canvas(window, width=750, height=1000)
    frame = tk.Frame(canvas)

    scrollbar = tk.Scrollbar(window, command=canvas.yview)
    canvas.configure(yscrollcommand=scrollbar.set)

    scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
    canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
    canvas.create_window((4, 4), window=frame, anchor="nw")

    title_label = tk.Label(
        frame, text=title_text, font=('arial', 30))

    frame.bind("<Configure>", lambda event,
               canvas=canvas: onFrameConfigure(canvas))

    title_label.grid(
        row=0, column=0, columnspan=2, sticky='w')

    ttk.Separator(frame, orient=tk.HORIZONTAL).grid(
        row=2, columnspan=2, sticky='ew', pady=5)

    return frame 
Example #24
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 #25
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 #26
Source File: _backend_tk.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def _get_groupframe(self, group):
        if group not in self._groups:
            if self._groups:
                self._add_separator()
            frame = Tk.Frame(master=self, borderwidth=0)
            frame.pack(side=Tk.LEFT, fill=Tk.Y)
            self._groups[group] = frame
        return self._groups[group] 
Example #27
Source File: _backend_tk.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def _add_separator(self):
        separator = Tk.Frame(master=self, bd=5, width=1, bg='black')
        separator.pack(side=Tk.LEFT, fill=Tk.Y, padx=2) 
Example #28
Source File: _backend_tk.py    From CogAlg with MIT License 5 votes vote down vote up
def _get_groupframe(self, group):
        if group not in self._groups:
            if self._groups:
                self._add_separator()
            frame = tk.Frame(master=self, borderwidth=0)
            frame.pack(side=tk.LEFT, fill=tk.Y)
            self._groups[group] = frame
        return self._groups[group] 
Example #29
Source File: _backend_tk.py    From CogAlg with MIT License 5 votes vote down vote up
def _add_separator(self):
        separator = tk.Frame(master=self, bd=5, width=1, bg='black')
        separator.pack(side=tk.LEFT, fill=tk.Y, padx=2) 
Example #30
Source File: UICommon.py    From RaspberryPiBarcodeScanner with MIT License 5 votes vote down vote up
def table_title(self, cellframe, celltext, wraplength=0, justify=tk.LEFT, row=0, column=0, rowspan=1, columnspan=1, sticky=tk.N+tk.S+tk.E+tk.W):
        #
        # create a table title frame and label and add it to a grid
        #
        cell = tk.Frame(cellframe, bg=Config.style_header_background_colour, highlightthickness=Config.style_header_border_width, highlightbackground=Config.style_header_border_colour)
        label = tk.Label(cell, text=celltext,wraplength=wraplength, justify=justify,background=Config.style_header_background_colour, foreground=Config.style_header_foreground_colour, padx=5, pady=10,  font=Config.style_row_font)
        label.pack(side=tk.LEFT, fill=tk.Y)
        cell.grid(row=row, column=column, sticky=sticky, rowspan=rowspan, columnspan=columnspan)
        return cell