A
A
Artyom D2021-09-07 11:40:35
Python
Artyom D, 2021-09-07 11:40:35

How to implement tabs in Tkinter?

Hello, the question is: how can I display data in a tabular form from a csv file in an application window on Tkinter?

I want to make two tabs, in one the user makes a new entry, and in the second a table is displayed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-09-07
@Vindicar

ttk.Notebook to the rescue.

import tkinter as tk
from tkinter import ttk

# root window
root = tk.Tk()
root.geometry('400x300')
root.title('Notebook Demo')

# create a notebook
notebook = ttk.Notebook(root)
notebook.pack(pady=10, expand=True)

# create frames
frame1 = ttk.Frame(notebook, width=400, height=280)
frame2 = ttk.Frame(notebook, width=400, height=280)

frame1.pack(fill='both', expand=True)
frame2.pack(fill='both', expand=True)

# add frames to notebook
notebook.add(frame1, text='General Information')
notebook.add(frame2, text='Profile')

root.mainloop()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question