Python tkinter.PanedWindow() Examples

The following are 11 code examples of tkinter.PanedWindow(). 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: ui_utils.py    From thonny with MIT License 6 votes vote down vote up
def __init__(self, master, position_key=None, preferred_size_in_pw=None, **kwargs):

        tk.PanedWindow.__init__(self, master, **kwargs)
        self._pane_minsize = 100
        self.position_key = position_key
        self._restoring_pane_sizes = False

        self._last_window_size = (0, 0)
        self._full_size_not_final = True
        self._configure_binding = self.bind("<Configure>", self._on_window_resize, True)
        self._update_appearance_binding = self.bind(
            "<<ThemeChanged>>", self._update_appearance, True
        )
        self.bind("<B1-Motion>", self._on_mouse_dragged, True)
        self._update_appearance()

        # should be in the end, so that it can be detected when
        # constructor hasn't completed yet
        self.preferred_size_in_pw = preferred_size_in_pw 
Example #2
Source File: test_widgets.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def create(self, **kwargs):
        return tkinter.PanedWindow(self.root, **kwargs) 
Example #3
Source File: test_widgets.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def create(self, **kwargs):
        return tkinter.PanedWindow(self.root, **kwargs) 
Example #4
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 #5
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 #6
Source File: test_widgets.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def create(self, **kwargs):
        return tkinter.PanedWindow(self.root, **kwargs) 
Example #7
Source File: ui_utils.py    From thonny with MIT License 5 votes vote down vote up
def add(self, child, **kw):
        kw.setdefault("minsize", self._pane_minsize)

        tk.PanedWindow.add(self, child, **kw)
        self._update_visibility()
        self._check_restore_preferred_sizes() 
Example #8
Source File: ui_utils.py    From thonny with MIT License 5 votes vote down vote up
def remove(self, child):
        tk.PanedWindow.remove(self, child)
        self._update_visibility()
        self._check_restore_preferred_sizes() 
Example #9
Source File: ui_utils.py    From thonny with MIT License 5 votes vote down vote up
def forget(self, child):
        tk.PanedWindow.forget(self, child)
        self._update_visibility()
        self._check_restore_preferred_sizes() 
Example #10
Source File: ui_utils.py    From thonny with MIT License 5 votes vote down vote up
def destroy(self):
        self.unbind("<Configure>", self._configure_binding)
        self.unbind("<<ThemeChanged>>", self._update_appearance_binding)
        tk.PanedWindow.destroy(self) 
Example #11
Source File: demo.py    From OpenCV-Python-Tutorial with MIT License 3 votes vote down vote up
def __init__(self):
        root = tk.Tk()
        root.title('OpenCV Demo')

        self.win = win = tk.PanedWindow(root, orient=tk.HORIZONTAL, sashrelief=tk.RAISED, sashwidth=4)
        self.win.pack(fill=tk.BOTH, expand=1)

        left = tk.Frame(win)
        right = tk.Frame(win)
        win.add(left)
        win.add(right)

        scrollbar = tk.Scrollbar(left, orient=tk.VERTICAL)
        self.demos_lb = demos_lb = tk.Listbox(left, yscrollcommand=scrollbar.set)
        scrollbar.config(command=demos_lb.yview)
        scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
        demos_lb.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)

        self.samples = {}
        for fn in glob('*.py'):
            name = splitfn(fn)[1]
            if fn[0] != '_' and name not in exclude_list:
                self.samples[name] = fn

        for name in sorted(self.samples):
            demos_lb.insert(tk.END, name)

        demos_lb.bind('<<ListboxSelect>>', self.on_demo_select)

        self.cmd_entry = cmd_entry = tk.Entry(right)
        cmd_entry.bind('<Return>', self.on_run)
        run_btn = tk.Button(right, command=self.on_run, text='Run', width=8)

        self.text = text = ScrolledText(right, font=('arial', 12, 'normal'), width = 30, wrap='word')
        self.linker = linker = LinkManager(text, self.on_link)
        self.text.tag_config("header1", font=('arial', 14, 'bold'))
        self.text.tag_config("header2", font=('arial', 12, 'bold'))
        text.config(state='disabled')

        text.pack(fill='both', expand=1, side=tk.BOTTOM)
        cmd_entry.pack(fill='x', side='left' , expand=1)
        run_btn.pack()