简体   繁体   中英

How to divide Notebook tab into two sections in Tkinter?

I have 2 notebooks or in other words tabs, I'll call them tabs in this question. One called Main , which is my primarily focus on. For this tab, I need to separate two sides to that specific tab and call them: left_side & right_side . Reason for this is, so I am able to structure the layout for that tab using Pack instead of Grid .

Here is the code for notebook for one of my Classes:

 class App:
    def __init__(self,master):
        notebook = ttk.Notebook(master)

        notebook.pack(expand = 1, fill = "both")
        #Frames
        main = ttk.Frame(notebook)
        manual = ttk.Frame(notebook)
        notebook.add(main, text='Main')
        notebook.add(manual, text='Sub')

How can I possibly divide the Main tab with two sides?

You do it the same way you do it anywhere else in tkinter. Tabs don't require anything special.

left = ttk.Frame(main)
right = ttk.Frame(main)

left.pack(side="left", fill="both", expand=True)
right.pack(side="right", fill="both", expand=True)

Of course, you don't have to use pack . You can use grid , a panedwindow , etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM