a. Is it possible to highlight the combobox when we hover the mouse over the button ? b. Because if its menu button we have the option like activebackground which helps to highlight the menu button when the mouse is hovered over it.
I tried someoptions for the combobox but its just changing the color of the selection or listbox etc but unable to highlight the combobox when mouse moves over it.
Can anyone provide some suggestion or comments for the same ?
#!/usr/intel/bin/python2.7
import Tkinter
from Tkinter import *
from Tkinter import Tk, StringVar
import ttk
import tkFont
try:
import Tkinter as tk
import Tkinter.ttk as ttk
except ImportError:
import Tkinter as tk
import ttk
class Application:
def __init__(self, parent):
self.parent = parent
self.combo()
def combo(self):
MyFontBtn = tkFont.Font(family='courier', size=20, weight=tkFont.BOLD)
self.box_value = StringVar()
self.box = ttk.Combobox(self.parent, textvariable=self.box_value, state='readonly', width=39, font=MyFontBtn)
self.box['values'] = ('Default', 'User Defined', 'Load From SS')
self.box.set("Hello Click Drop Down")
self.box['state'] = 'readonly'
self.box.bind("<<ComboboxSelected>>", self.print_selected_value)
self.box.option_add('*TCombobox*Listbox.selectBackground', 'gray50')
self.box.option_add('*TCombobox*Listbox.font', MyFontBtn)
#self.box.option_add('TCombobox.background', 'gray50')
style1 = ttk.Style()
style1.map('TCombobox', selectbackground=[('readonly', 'red')])
#style1.map('TCombobox', selectforeground=[('readonly', 'blue')])
style1.map("self.box",
foreground=[('pressed', 'red'), ('active', 'blue')]
#background=[('pressed', '!disabled', 'black'), ('active', 'white')]
)
self.box.grid(column=0, row=0)
def print_selected_value(self, *args):
print "Vaue selected is:", self.box.get()