Tk Source Code

View Ticket
Login
Ticket UUID: 3543420
Title: Toggle.TButton style doesn't work on Windows
Type: Bug Version: obsolete: 8.5.11
Submitter: Created on: 2012-07-13 07:44:48
Subsystem: 88. Themed Tk Assigned To: jenglish
Priority: 5 Medium Severity: Minor
Status: Pending Last Modified: 2016-08-20 15:28:44
Resolution: Remind Closed By: nobody
    Closed on: 2012-07-13 17:18:44
Description:
I need a toggle button for an expansion dialog (i.e., you click the button and it stays down and the dialog expands to show more widgets; you click the button again and it comes up and the dialog contracts to show fewer widgets). See the OpenOffice Find dialog for an example.

This is easy to achieve by creating a custom style. However, it only seems to work on Linux, it does not work on Windows. Attatched is some code that illustrates the point (in Python 3/tkinter).
User Comments: jenglish added on 2012-07-14 00:18:44:
It looks like the attached toggle.pyw is relying on "-relief raised" / "-relief sunken", but uses the default TButton layout.  The (elements in) that layout are not guaranteed to support -relief; and in fact on Windows XP, Windows Vista, and OSX, they do not.   You'll need to either assemble a Toggle.TButton layout from platform-independent elements, or provide theme-specific settings.

Also: it looks like toggle.pyw implements something that acts quite a bit like a checkbutton.  You might consider using a ttk::checkbutton instead.

added on 2012-07-13 14:44:48:

File Added - 448812: toggle.pyw

Attachments: