python - Using styles to modify frame colour -
i unable modify colour when using ttk create tabbed frames. in standart tkinter frame, process simple. using python 2.7.6 i'd appreciate tip i'm going wrong.
root = tkinter.tk() s = ttk.style() s.configure('tab1', background='black', foreground='blue') n = ttk.notebook(root) f1 = ttk.frame(style='tab1.tframe') # first tab f2 = ttk.frame() # second tab n.add(f1, text='log ticket') n.add(f2, text='work orders') n.grid()
as understand documentation, tframe default settings (grey) should updates style 'tab1' have applied frame creation, nothing changes.
this works:
import tkinter, ttk root = tkinter.tk() s = ttk.style() s.configure('tab1.tframe', background='black', foreground='blue') n = ttk.notebook(root) f1 = ttk.frame(root,style='tab1.tframe') # first tab f2 = ttk.frame() # second tab n.add(f1, text='log ticket') n.add(f2, text='work orders') n.pack(fill=tkinter.both, expand=true) root.mainloop()
Comments
Post a Comment