Dec-27-2020, 02:16 PM
(This post was last modified: Dec-27-2020, 02:17 PM by horrorfodrasz.)
Hi,
According to this bug tracking there is an issue in Tkinter. It is fixed in tkinter v8.6.10 but in my Python 3.9.1 there is only 8.6.9.
https://bugs.python.org/issue36468
I think it should work the following ways:
self.style = ttk.Style()
self.style.configure("mystyle.Treeview", background="black", fieldbackground="black", foreground="white", highlightthickness=0, bd=0, font=('Calibri', 11)) # Modify the font of the body
self.style.configure("mystyle.Treeview.Heading", font=('Calibri', 13,'bold')) # Modify the font of the headings
self.style.layout("mystyle.Treeview", [('mystyle.Treeview.treearea', {'sticky': 'nswe'})]) # Remove the borders
self.Student_table=ttk.Treeview(Table_Frame, style="mystyle.Treeview", columns=("roll","name","email","gender","contact","dob","Address"), xscrollcommand=scroll_x.set,yscrollcommand=scroll_y.set)
or with tags
self.Student_table.insert("", "end", values=('1','XY','[email protected]'), tags=('odd',))
self.Student_table.insert("", "end", values=('2','JD','[email protected]'), tags=('even',))
self.Student_table.tag_configure('odd', background='#E8E8E8')
self.Student_table.tag_configure('even', background='#FFFF00')
but currently it doesn't work. Maybe it is the Tkinter issue. We should wait v8.6.10
According to this bug tracking there is an issue in Tkinter. It is fixed in tkinter v8.6.10 but in my Python 3.9.1 there is only 8.6.9.
https://bugs.python.org/issue36468
I think it should work the following ways:
self.style = ttk.Style()
self.style.configure("mystyle.Treeview", background="black", fieldbackground="black", foreground="white", highlightthickness=0, bd=0, font=('Calibri', 11)) # Modify the font of the body
self.style.configure("mystyle.Treeview.Heading", font=('Calibri', 13,'bold')) # Modify the font of the headings
self.style.layout("mystyle.Treeview", [('mystyle.Treeview.treearea', {'sticky': 'nswe'})]) # Remove the borders
self.Student_table=ttk.Treeview(Table_Frame, style="mystyle.Treeview", columns=("roll","name","email","gender","contact","dob","Address"), xscrollcommand=scroll_x.set,yscrollcommand=scroll_y.set)
or with tags
self.Student_table.insert("", "end", values=('1','XY','[email protected]'), tags=('odd',))
self.Student_table.insert("", "end", values=('2','JD','[email protected]'), tags=('even',))
self.Student_table.tag_configure('odd', background='#E8E8E8')
self.Student_table.tag_configure('even', background='#FFFF00')
but currently it doesn't work. Maybe it is the Tkinter issue. We should wait v8.6.10