Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

change the style of notebook tkinter


# style=ttk.Style()
# style.configure("TNotebook", highlightbackground="#848a98") # if I use another option like - background="#848a98" - the style changes, but with - highlightbackground="#848a98" - option the style doesn't change..
 
# Origin (modified) of style code: https://www.programcreek.com/python/example/104109/tkinter.ttk.Notebook Number 25
 
style = ttk.Style()
 
style.theme_create('pastel', settings={
    ".": {
        "configure": {
            "background": '#ffffcc', # All except tabs
            "font": 'red'
        }
    },
    "TNotebook": {
        "configure": {
            "background":'#848a98', # Your margin color
            "tabmargins": [2, 5, 0, 0], # margins: left, top, right, separator
        }
    },
    "TNotebook.Tab": {
        "configure": {
            "background": '#d9ffcc', # tab color when not selected
            "padding": [10, 2], # [space between text and horizontal tab-button border, space between text and vertical tab_button border]
            "font":"white"
        },
        "map": {
            "background": [("selected", '#ccffff')], # Tab color when selected
            "expand": [("selected", [1, 1, 1, 0])] # text margins
        }
    }
})
 
style.theme_use('pastel')
 
MainNotebook = ttk.Notebook(root)
# MainNotebook.place(x=16, y=16)
MainNotebook.pack(fill=BOTH, expand=True)
Comment

PREVIOUS NEXT
Code Example
Python :: exact distance 
Python :: Python program to check leap year or not? 
Python :: shuffle array python 
Python :: pygame change icon 
Python :: python conditional assignment 
Python :: how to clear screen python 
Python :: append one column pandas dataframe 
Python :: requests get cookies from response 
Python :: drop rows in list pandas 
Python :: unique words from pandas 
Python :: rabbitmq pika username password 
Python :: python pickle example 
Python :: list of characters python 
Python :: leaky relu keras 
Python :: fatal error detected failed to execute script 
Python :: python format float 
Python :: program to find even numbers in python 
Python :: oppsite of abs() python 
Python :: matplotlib add legend axis x 
Python :: python sum comprehension 
Python :: np range data 
Python :: print progress without next line python 
Python :: arabic in python 
Python :: argparse multiple arguments as list 
Python :: pygame draw rect syntax 
Python :: check dictionary is empty or not in python 
Python :: convert series to datetime 
Python :: json load python 
Python :: pandas add column from list 
Python :: two input number sum in python 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =