Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python tkinter ttk one radio button appears the wrong size

I'm using Tkinter ttk radio buttons, and have a peculiar issue. The last radio button created appears larger than the others at first. Once the mouse is placed over it, it snaps to the right size.

The issue looks like this:

enter image description here

And this is the code I'm using, in its entirety:

import tkinter
from tkinter import ttk

root = tkinter.Tk()

radioSelect = tkinter.IntVar()
radio1 = ttk.Radiobutton(root, text="A", variable=radioSelect, value=1)
radio2 = ttk.Radiobutton(root, text="B", variable=radioSelect, value=2)

radio1.grid()
radio2.grid()

root.mainloop()

This appears if I use grid or place, and it appears on checkboxes as well as radio buttons. The issue doesn't appear if I use the tkinter radio buttons, rather than the ttk ones, but I'd like to use the ttk ones because they look nicer.

I'm running Windows 7 64-bit, Python version

3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 bit (AMD64)]

I've searched but am unable to find anyone with a similar issue.

What's going on here?

UPDATE: This only occurs when using the "vista" theme, which is the default (at least on my machine). If another theme is specified, the issue goes away.

like image 947
gfrung4 Avatar asked Feb 13 '15 01:02

gfrung4


1 Answers

As some comment said, it must be OS related issue, i tested your code and everything is normal and working fine,unfortunately, after some long searches, i found out that there is no way to resize the button size.

like image 141
ghazigamer Avatar answered Nov 07 '22 06:11

ghazigamer