[issue21665] 2.7.7 ttk widgets not themed

Les Bothwell report at bugs.python.org
Thu Jun 5 09:29:04 CEST 2014


Les Bothwell added the comment:

The code below shows a "windows themed" button with 2.7.6 but a plain "tkinter" button with 2.7.7. Functionality is Ok both cases.

from win32api import GetMonitorInfo, MonitorFromWindow
from win32con import MONITOR_DEFAULTTONEAREST

from Tkinter import *
import ttk
root = Tk()
root.title("Get Desktop Size")      # set title
root.resizable(0, 0)                # disable resizing (also changes border)
root.attributes("-toolwindow", 1)   # remove max and min buttons

hwnd = int(eval(root.wm_frame()))   # get the root window handle
txDesk = StringVar()

def OnClick(*args):
    hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST)
    Info = GetMonitorInfo(hMonitor)["Work"]
    txDesk.set("%d x %d" % (Info[2] - Info[0], Info[3] - Info[1]))


But1 = ttk.Button(root, text="Click me on each monitor", command=OnClick)
Lbl1 = ttk.Label(root, textvariable=txDesk, anchor="center")
txDesk.set('')
But1.pack(side=TOP)
Lbl1.pack(side=TOP)
root.mainloop()

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21665>
_______________________________________


More information about the Python-bugs-list mailing list