Python Forum
Changing the BG-color of the table
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing the BG-color of the table
#2
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
Reply


Messages In This Thread
Changing the BG-color of the table - by Pattaya - Dec-25-2020, 05:45 PM
RE: Changing the BG-color of the table - by horrorfodrasz - Dec-27-2020, 02:16 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020