Python 2.7 and Tkinter/tkk: Notebook tabs text top-aligned Python 2.7 and Tkinter/tkk: Notebook tabs text top-aligned tkinter tkinter

Python 2.7 and Tkinter/tkk: Notebook tabs text top-aligned


It's a bit difficult to say as I am unable to recreate the error you are experiencing. I think the best option would be to create a custom theme and then to change the layout options for your tabs

import Tkinter as tkimport ttkwin = tk.Tk()frame = ttk.Frame()style = ttk.Style()style.theme_create("custom_tabs", parent="alt", settings={    "TNotebook.Tab": {        "configure": {"padding": [10, 10, 10, 10]}        }})style.theme_use("custom_tabs")win.title("Python GUI")tabControl = ttk.Notebook(win)tab1 = ttk.Frame(tabControl)tabControl.add(tab1, text='Tab 1')tab2 = ttk.Frame(tabControl)tabControl.add(tab2, text="Tab2")ttk.Label(tab1, text="Hello, this is a tab").grid(column=0, row=0)ttk.Label(tab2, text="Hello, this is another tab").grid(column=0, row=0)tabControl.pack(expand=0, fill="both")win.mainloop()

Simply change the padding as you need it, the values are as follows: [left padding, top padding, right padding, bottom padding]