python tkinter treeview 改变颜色,TKinter样式和Treeview点击问题

I am struggling with styles in TKinter

My main problem is that you cannot click anything in the treeview.

To test, simply press the "Press To Test" Button

For some reason it looks like, style.theme_create takes over my treeview widget, and no matter what I try, I cannot seem to find a solution around it. I tried activating the cursor, selection_set, focus_set, etc.

If I comment the style I can click, but not with it on.

I am still quite new to python and would appreciate some insight.

I tried the t1.bind('') and tried to find a selected style but can't seem to make it work, the bind on its own doesn't work. I've read the documentation but all i've tried related to the selection seems to fail.

#IMPORT LIBRARIES & MODULES

from tkinter import *

from tkinter import ttk

from tkinter import Tk,Frame

from tkinter.ttk import Notebook

from datetime import datetime,date,time

from PIL import ImageTk,Image

import pyodbc

import os, sys

import ldap

#APPLICATION - Start of Application

newroot = Tk()

#APPLICATION - Configure New Window Parameters

newroot.geometry("1200x600")

newroot.title(' PCT ')

newroot.grid_columnconfigure(0, weight=1)

newroot.grid_rowconfigure(0, weight=1)

#SET CUSTOM APPLICATION COLORS

bglight = '#7d8ea3'

bgmid = '#5a6b7e'

bgdark = '#3d4855'

cwhite = '#ffffff'

cgrey = '#dddddd'

#SET STYLING FOR MENU

style = ttk.Style()

style.theme_create( "fclassic", parent="alt", settings={

"TNotebook": {

"configure": {

"tabmargins": [2, 5, 2, 0],

"background": bgdark,

"foreground": cwhite}},

"TNotebook.Tab": {

"configure": {"padding": [5, 1],

"background": bglight,

"foreground": cwhite,

"font": ("Century Gothic", '14', 'italic')},

"map":

{"background": [("selected", bgmid)],

"expand": [("selected", [1, 1, 1, 0])

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值