How can we create a new layout by defining new elements in tkinter ttk widgets
I want to create/modify new elements and define a new layout in tkinter ttk syle but I not sure how to configure that style in a widget.
import tkinter as tk
from tkinter import ttk
def _initialize_style():
style = ttk.Style()
image = tk.PhotoImage(data=image_data, format="gif -index 0")
style.element_create("Button.button2",
"image", image,
sticky="e")
return style
style = _initialize_style()
root = tk.Tk()
button = ttk.Button(root, text='style', style='TButton')
button.pack()
root.mainloop()
can anyone help me with that.
Check out following resources:
- Official Docs
- Private but very helpful docs
- Tk docs
- python tutorial 1
- python tutorial 2
- python tutorial 3
I suggest you to edit the exiting layout or create a new them and add a layout to it, as it seems the much infomation of ttk and its examples are not available.