I am having a weird issue with my radio buttons. When I run my program, they are initially unselected (as expected). However, if I mouse over one of them, they will select themselves, and this can allow both to be selected at the same time. This only seems to happen once per program execution, and manually selecting either of them will fix the issue, but I can't figure out why it's happening in the first place.
What makes this issue strange is, when I first wrote this code outside of a function it worked, so it seems the code being in a function might have something to do with it.
Any help appreciated.
def createPriceFrame(self):
priceFrame = tk.Frame(self.parent, bg = 'lightgreen')
priceFrame.place(relx = 0.5, rely = 0.45, relwidth = 0.35, relheight = 0.15, anchor='c')
option = tk.IntVar()
radioUnder = tk.Radiobutton(priceFrame, text = "Under", value = 1, var = option, bg = 'lightgreen', font = ('Arial', 12, 'bold'))
radioUnder.grid(row = 1, column = 0)
radioOver = tk.Radiobutton(priceFrame, text =" Over", value = 2, var = option, bg = 'lightgreen', font = ('Arial', 12, 'bold'))
radioOver.grid(row = 1, column = 1)