'Tkinter IntVar attribute error when using radiobuttons

I am making a simple calculator using tkinter, and this error message keeps showing up.

AttributeError: type object 'Tk' has no attribute 'IntVar'

Traceback:

File "c:/Desktop/my programs/Calculator.py", line 9, in v = Tk.IntVar() AttributeError: type object 'Tk' has no attribute 'IntVar'

here is my code:

import tkinter as tk
from tkinter import *
import time

root = Tk()
tk = Tk()
v = Tk.IntVar()
v.set(1)  # initializing the choice   
root.title('Calculator')
root.geometry('600x400+50+50')
def calucator():
   value1 = tk.StringVar(root, Value= 'Number:' )
   value1 = tk.Entry(root, textvariable=value1).pack()
   time.sleep(1)
   value2 = tk.StringVar(root, Value= 'Number:' )
   value2 = tk.Entry(root, textvariable=value2).pack()
   time.sleep(1)  

   operations = [("Addition", 101),
                 ("Subtraction", 102),
                 ("Divison", 103),
                 ("Mulitplication", 104)]

   def ShowChoice():
       print(v.get())

       tk.Label(root, 
            text="""Choose your Operation""",
            justify = tk.LEFT,
            padx = 20).pack()

            for operations, val in operations:
               tk.Radiobutton(root, 
               text=operations,
               padx = 20, 
               variable=v, 
               command=ShowChoice,
               value=val).pack(anchor=tk.W)  
         

if val==101:
    print('value1 + value2')

elif val==102:
    print('value1 - value2')

elif val==103:
    print('value1 * value2')

elif val==104:
    print('value1 / value2')

else:
    close

I have looked everywhere and are yet to find a fix. I am aware that there are other threads on stack overflow with similar problems to mine however all the solutions I have tried have not worked.

Any help would be great! mrt



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source