Pythonのtkinterモジュールを使用して作成しているアプリケーションでtktableを使用しています。
セルを選択して入力すると、テキストの色が白になり、非常に読みにくくなります。たとえば、この色を黒に変更するにはどうすればよいですか。
私はすでに「前景」の色を変更しましたが、違いはありません。
self.table = tktable.Table(self, rows=5, cols=5, multiline=0, font=("Helvetica", 10), foreground='Red', background='White', cache=True, colstretchmode='all')
self.table.grid(row=0, column=1, padx=10, pady=10, sticky='e,w')
このスレッドを見つけた人のための完全なソリューション:
import Tkinter as tk
import tktable
class App(tk.Frame):
def __init__(self, parent):
tk.Frame.__init__(self, parent)
self.parent = parent
self.Main()
self.grid()
def Main(self):
self.table = tktable.Table(self, rows=5, cols=5, multiline=0, font=("Helvetica", 10), foreground='Black', background='White', cache=True, colstretchmode='all')
self.table.tag_configure('active', foreground='black') # <<<ADDED LINE/ SOLUTION
self.table.grid(row=0, column=0, padx=10, pady=10, sticky='e,w')
if __name__ == "__main__":
root = tk.Tk()
app = App(root)
app.mainloop()