Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Terry Reedy Newsgroups: comp.lang.python Subject: Re: Adding borders to ttk radiobuttons Date: Wed, 30 Mar 2016 12:35:39 -0400 Lines: 81 Message-ID: References: <56fbe699$0$4548$426a74cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de I8228SIqzflrYz9jVEyo2gT1vuA0vud2WIL3a6xt8PRQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'skip:[ 20': 0.03; 'configure': 0.04; 'root': 0.04; "'',": 0.07; 'default.': 0.07; 'ast': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'jan': 0.11; '"mark': 0.16; "'default',": 0.16; "'left',": 0.16; 'outputs': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'sadly': 0.16; 'skip:n 50': 0.16; 'subject:Adding': 0.16; 'theme.': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'windows': 0.20; 'lawrence': 0.22; 'tkinter': 0.22; 'am,': 0.23; 'seems': 0.23; 'import': 0.24; 'url:edu': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; "skip:' 10": 0.28; 'skip:( 20': 0.28; 'skip:s 30': 0.31; 'option': 0.31; 'says': 0.32; 'table': 0.32; 'skip:. 10': 0.32; 'options': 0.33; 'except': 0.34; 'displays': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'there': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'display': 0.37; 'received:org': 0.37; 'button': 0.38; 'names': 0.38; 'does': 0.39; 'to:addr:python.org': 0.40; 'mark': 0.40; 'some': 0.40; 'received:96': 0.63; 'believe': 0.66; 'python-list': 0.66; 'here': 0.66; 'dans': 0.72; 'url:help': 0.73; '3.5.1': 0.84; 'ttk': 0.84; 'url:tkinter': 0.84; 'received:fios.verizon.net': 0.91 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: pool-96-227-207-81.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:106092 On 3/30/2016 11:01 AM, Mark Lawrence via Python-list wrote: > On 30/03/2016 15:45, ast wrote: >> >> "Mark Lawrence" a =C3=A9crit dans le message= de >> news:mailman.204.1459343690.28225.python-list@python.org... >>> I believe something like this should suffice to display borders aroun= d >>> the radiobuttons. >>> >>> import tkinter as tk >>> import tkinter.ttk as ttk >>> root =3D tk.Tk() >>> style =3D ttk.Style() >>> style.configure('BW.TRadiobutton', borderwidth=3D5) >>> buttonVar =3D tk.IntVar() >>> rb1 =3D ttk.Radiobutton(text=3D'Hello mum', variable=3DbuttonVar, val= ue=3D1) >>> rb1.configure(style=3D'BW.TRadiobutton') >>> rb1.grid(row=3D0, column=3D0) >>> rb2 =3D ttk.Radiobutton(text=3D'Hello dad', variable=3DbuttonVar, val= ue=3D2) >>> rb2.configure(style=3D'BW.TRadiobutton') >>> rb2.grid(row=3D1, column=3D0) >>> root.mainloop() >>> >>> Sadly no borders :( What have I missed? Python 3.5.1 on Windows 10.= >>> >> >> it seems there is no border on the radio button >> >>> style.layout('BW.TRadiobutton') >> >> [('Radiobutton.padding', {'children': [('Radiobutton.indicator', >> {'side': 'left', 'sticky': ''}), ('Radiobutton.focus', {'side': 'left'= , >> 'sticky': '', 'children': [('Radiobutton.label', {'sticky': >> 'nswe'})]})], 'sticky': 'nswe'})] > > That's as may be, but from Table 56 "ttk Radiobutton options not in > ttk.Radiobutton" here > http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/ttk-Radiobutton.html > it says "borderwidth or bd - Configure this option using a style." Components depend on the theme. In some themes, Radiobutton does have a = border. On Windows 10, I ran >>> for s in style.theme_names(): style.theme_use(s) style.theme_use() style.layout('TRadiobutton') Theme names are ('winnative', 'clam', 'alt', 'default', 'classic',=20 'vista', 'xpnative') with 'vista'the default. Outputs were the same as ab= ove 'vista' [('Radiobutton.padding', {'sticky': 'nswe', 'children': [('Radiobutton.indicator', {'sticky': '', 'side': 'left'}), ('Radiobutton.focus', {'sticky': '', 'children': [('Radiobutton.label', {'sticky': 'nswe'})], 'side': 'left'})]})] except for this 'classic' [('Radiobutton.highlight', {'sticky': 'nswe', 'children':=20 [('Radiobutton.border', {'sticky': 'nswe', 'children':=20 [('Radiobutton.padding', {'sticky': 'nswe', 'children':=20 [('Radiobutton.indicator', {'sticky': '', 'side': 'left'}),=20 ('Radiobutton.label', {'sticky': 'nswe', 'side': 'left'})]})]})]})] =2Etheme_names() only displays the themes for the OS. I believe that=20 there is a way to access themes for other OSes (unix, mac) but don't=20 remember. --=20 Terry Jan Reedy