You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was using CTkTable and created a function to extract text color. I thought it might be the same function for other people to use, so I left an discussion like this.
The code below is a function to extract text color, it does not extract the text color of the header.
def get_column_text_color(self, column_index):
text_colors = []
for row in range(1, self.rows):
text_color = self.data.get((row, column_index), {}).get("args").get("text_color")
text_colors.append(text_color)
return text_colors
This is example code
import customtkinter
from CTkTable import *
from CTkColorPicker import *
root = customtkinter.CTk()
def show(cell):
if cell["column"] == 4:
table.select(cell["row"], cell["column"])
pick_color = AskColor() # open the color picker
color = pick_color.get() # get the color string
table.insert(cell["row"], cell["column"], value=table.get(cell["row"], cell["column"]), text_color = color)
def get_text_color():
color_column_list = table.get_column_text_color(4)
for color_column in color_column_list:
print(color_column)
value = [["A","B","C","D","E"],[1,2,3,4,"▇▇"],[0,0,0,0,"▇▇"],[1,2,0,0,"▇▇"],[1,2,3,4,"▇▇"]]
table = CTkTable(master=root, row=5, column=5, values=value, command=show ,header_color="green")
table.pack(expand=True, fill="both", padx=20, pady=20)
btn = customtkinter.CTkButton(root, text='color print', width=150, command=get_text_color)
btn.pack(expand=True,pady=5, padx=5)
root.mainloop()
I extracted the text code and used it to color the graph.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, Everyone!!
I was using CTkTable and created a function to extract text color. I thought it might be the same function for other people to use, so I left an discussion like this.
The code below is a function to extract text color, it does not extract the text color of the header.
This is example code
I extracted the text code and used it to color the graph.
Beta Was this translation helpful? Give feedback.
All reactions