Python Forum
[Tkinter] Need help please properly putting tabs within a PanedWindow
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Need help please properly putting tabs within a PanedWindow
#1
Hello all.

I'm trying to get a PanedWindow to have tabs in it. I'm so close but I think my confusion with __init__ is getting me.

I have two examples that have me near, yet so far away.

This example here is closer to what I want, but not working out.

[Image: vvvv.png]
--------------------------------------------------------------------------------------------
The Entry widget loses its PanedWindow capability

class MainApplication(tk.Frame):
    def __init__(self, parent, *args, **kwargs):
#        super(Frame, self).__init__()   
        tk.Frame.__init__(self, parent, *args, **kwargs)
#        ttk.Label.__init__(self, parent)        
        self.parent = parent

        self.w1 = tk.PanedWindow()  
        self.w1.pack(fill = tk.BOTH, expand = 1)  
 
        self.left = tk.Entry(self.w1, bd = 3)  
        self.w1.add(self.left)  

        self.w2 = tk.PanedWindow(self.w1, orient = tk.VERTICAL)  
        self.w1.add(self.w2)  
  
# -------------------------------------------------------------------------
        self.TAB_CONTROL = ttk.Notebook(self.w2)
        self.TAB1 = ttk.Frame(self.TAB_CONTROL)
        self.TAB_CONTROL.add(self.TAB1, text='Tab 1')
        self.TAB2 = ttk.Frame(self.TAB_CONTROL)
        self.TAB_CONTROL.add(self.TAB2, text='Tab 2')
        self.TAB_CONTROL.pack(expand=1, fill="both")
        ttk.Label(self.TAB1, text="This is Tab 1").grid(column=0, row=0, padx=10, pady=10)
#        ttk.Label(self.TAB2, text="This is Tab 2").grid(column=0, row=0, padx=10, pady=10)
# --------------------------------------------------------------------------

        tk.Entry(self.TAB1).grid(column=0, row=1, padx=10, pady=10) 
   #     self.e2 = tk.Entry(self.w2)  
  
  #      self.w2.add(self.e1)  
  #      self.w2.add(self.e2)  
  
 #       self.bottom = tk.Button(self.w2, text = "Add")  
 #       self.w2.add(self.bottom)  

if __name__ == "__main__":
    root = tk.Tk()
    MainApplication(root).pack()
    root.mainloop()
-----------------------------------------------------------------------------------
This example here the PanedWindows work, though I want the right panal to be in the first tab, then subsequently put panedWindow on the second tab.

[Image: vvvv2.png]

class MainApplication(tk.Frame):
    def __init__(self, parent, *args, **kwargs):
#        super(Frame, self).__init__()   
        tk.Frame.__init__(self, parent, *args, **kwargs)
#        ttk.Label.__init__(self, parent)        
        self.parent = parent

# -------------------------------------------------------------------------
        self.TAB_CONTROL = ttk.Notebook(self.parent)
        self.TAB1 = ttk.Frame(self.TAB_CONTROL)
        self.TAB_CONTROL.add(self.TAB1, text='Tab 1')
        self.TAB2 = ttk.Frame(self.TAB_CONTROL)
        self.TAB_CONTROL.add(self.TAB2, text='Tab 2')
        self.TAB_CONTROL.pack(expand=1, fill="both")
        ttk.Label(self.TAB1, text="This is Tab 1").grid(column=0, row=0, padx=10, pady=10)
        ttk.Label(self.TAB2, text="This is Tab 2").grid(column=0, row=0, padx=10, pady=10)
# ---------------------------------------------------------------------------
        self.w1 = tk.PanedWindow()  
        self.w1.pack(fill = tk.BOTH, expand = 1)  

        self.left = tk.Entry(self.w1, bd = 5)  
        self.w1.add(self.left)  

        self.w2 = tk.PanedWindow(self.w1, orient = tk.VERTICAL)  
        self.w1.add(self.w2)  
  
        self.e1 = tk.Entry(self.w2)  
        self.e2 = tk.Entry(self.w2)  
  
        self.w2.add(self.e1)  
        self.w2.add(self.e2)  
  
        self.bottom = tk.Button(self.w2, text = "Add")  
        self.w2.add(self.bottom)  

if __name__ == "__main__":
    root = tk.Tk()
    MainApplication(root).pack()
    root.mainloop()
What I'm trying to get it looking like the first image, but with the panaledwindow in it working correctly.

Thanks for any help, being a noob sucks lol.

This might help show the vision, or perhaps confuse it more Idk lol.

[Image: vvvv3.png]
Reply


Messages In This Thread
Need help please properly putting tabs within a PanedWindow - by JackMack118 - Dec-03-2019, 08:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Found buttonstate in tabs MacTommu 4 2,011 Sep-22-2021, 05:56 PM
Last Post: deanhystad
  TabError: inconsistent use of tabs and spaces in indentation hobbyist 3 4,943 Jun-15-2021, 10:38 PM
Last Post: davide73_italy
Smile Panedwindow rfresh737 2 2,223 Apr-03-2021, 03:40 PM
Last Post: rfresh737
  [Tkinter] Vertical Tabs Alignment in Tkinter muhammadasim 2 6,077 Oct-05-2020, 08:40 AM
Last Post: Larz60+
  [PyQt] Drag items across tabs Alfalfa 5 4,834 Sep-01-2019, 11:58 PM
Last Post: Alfalfa
  [Tkinter] Adding space between Notebook tabs Columbo 4 4,587 Jul-10-2019, 10:46 PM
Last Post: Columbo
  [Tkinter] How to get a tabs works exactly same as google chrome sarthak260 0 3,806 Mar-07-2019, 10:45 AM
Last Post: sarthak260
  [Tkinter] How to create multilple tabs in tkinter from different classes Rishav 5 18,383 Jul-11-2018, 11:59 AM
Last Post: CCChris91
  How to create mutiple tabs in tkinter using oops Rishav 2 6,910 Jul-12-2017, 04:43 PM
Last Post: Rishav
  seprating columns of an listbox item and putting them into different entry gray 2 4,271 Feb-26-2017, 12:53 PM
Last Post: gray

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020