Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #106094

Re: Adding borders to ttk radiobuttons

From Terry Reedy <tjreedy@udel.edu>
Newsgroups comp.lang.python
Subject Re: Adding borders to ttk radiobuttons
Date 2016-03-30 12:38 -0400
Message-ID <mailman.217.1459356008.28225.python-list@python.org> (permalink)
References <mailman.204.1459343690.28225.python-list@python.org> <56fbe699$0$4548$426a74cc@news.free.fr> <56fbe905$0$4540$426a74cc@news.free.fr> <ndgqg8$fbr$1@ger.gmane.org>

Show all headers | View raw


On 3/30/2016 11:14 AM, Mark Lawrence via Python-list wrote:
> On 30/03/2016 15:55, ast wrote:
>>
>> "ast" <nomail@com.invalid> a écrit dans le message de
>> news:56fbe699$0$4548$426a74cc@news.free.fr...
>>>
>>> "Mark Lawrence" <breamoreboy@yahoo.co.uk> a écrit dans le message de
>>> news:mailman.204.1459343690.28225.python-list@python.org...
>>>> I believe something like this should suffice to display borders
>>>> around the radiobuttons.
>>>>
>>>> import tkinter as tk
>>>> import tkinter.ttk as ttk
>>>> root = tk.Tk()
>>>> style = ttk.Style()
>>>> style.configure('BW.TRadiobutton', borderwidth=5)
>>>> buttonVar = tk.IntVar()
>>>> rb1 = ttk.Radiobutton(text='Hello mum', variable=buttonVar, value=1)
>>>> rb1.configure(style='BW.TRadiobutton')
>>>> rb1.grid(row=0, column=0)
>>>> rb2 = ttk.Radiobutton(text='Hello dad', variable=buttonVar, value=2)
>>>> rb2.configure(style='BW.TRadiobutton')
>>>> rb2.grid(row=1, column=0)
>>>> 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'})]
>>
>> for more help:
>> http://www.tkdocs.com/tutorial/styles.html
>
> For this particular problem not of much use, or I wouldn't be asking :(

This page has some of the info needed to get a radiobutton with a 
border, at least my machine.  See my answer to your other response.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Adding borders to ttk radiobuttons Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-30 14:14 +0100
  Re: Adding borders to ttk radiobuttons "ast" <nomail@com.invalid> - 2016-03-30 16:45 +0200
    Re: Adding borders to ttk radiobuttons "ast" <nomail@com.invalid> - 2016-03-30 16:55 +0200
      Re: Adding borders to ttk radiobuttons Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-30 16:14 +0100
      Re: Adding borders to ttk radiobuttons Terry Reedy <tjreedy@udel.edu> - 2016-03-30 12:38 -0400
    Re: Adding borders to ttk radiobuttons Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-30 16:01 +0100
    Re: Adding borders to ttk radiobuttons Terry Reedy <tjreedy@udel.edu> - 2016-03-30 12:35 -0400
    Re: Adding borders to ttk radiobuttons Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-31 00:41 +0100

csiph-web