1

I want to customize the tkinter GUI and make it more responsive and interactive. I wanted to know to that is any method in which the color of a particular tab changes when it is selected? By default there is a dashed line that borders an active tab. I am trying to remove the dashed border and instead use a color changing scheme to denote an active or inactive tab. Below I am posting the relevant part of the code.

mainframe = ttk.Notebook(window,width=50, height=200) 
mainframe.grid(row=0,column=0,columnspan=50,rowspan=40,sticky='NESW')

#create frame style
frame_style=ttk.Style()
frame_style.configure('TFrame',background='#800000')


#create tabs within the frame.
tab1 = ttk.Frame(mainframe, style='Frame1.TFrame')
mainframe.add(tab1, text="TAB1")



tab2 = ttk.Frame(mainframe, style='Frame2.TFrame')
mainframe.add(tab2, text="TAB2")


tab3 = ttk.Frame(mainframe)
mainframe.add(tab3, text="TAB3")

tab4 = ttk.Frame(mainframe)
mainframe.add(tab4, text="TAB4")

tab5 = ttk.Frame(mainframe)
mainframe.add(tab5, text="TAB5")

window.mainloop() #end of GUI
Pratyush Karna
  • 179
  • 1
  • 2
  • 10
  • 1
    This might be relevant: https://stackoverflow.com/questions/22389198/ttk-styling-tnotebook-tab-background-and-borderwidth-not-working/29572789#29572789. – Bryan Oakley Feb 05 '19 at 17:41
  • Possible duplicate of [Change color of "tab header" in ttk.Notebook](https://stackoverflow.com/questions/23038356/change-color-of-tab-header-in-ttk-notebook) – Kamal Feb 06 '19 at 03:32

0 Answers0