Comments added to altered code shown below solving all the problems.
#!/usr/bin/python3 from tkinter import * from tkinter import ttk class MainWindow: def __init__(self, parent): # definisco gli attributi della finestra principale: self.parent = parent parent.title("My Software") # parent.iconbitmap("icon.ico") parent.geometry("530x515+360+200") parent.resizable(width=False, height=False) parent.configure(background="#f0f0f0") # Radio button "tools": tools = IntVar() tools.set(1) # set 1 as the default ttk.Radiobutton(self.parent, text="Menu 1", variable=tools, value=1).pack() ttk.Radiobutton(self.parent, text="Menu 2", variable=tools, value=2).pack() ttk.Radiobutton(self.parent, text="Menu 3", variable=tools, value=3).pack() ttk.Radiobutton(self.parent, text="Menu 4", variable=tools, value=4).pack() ttk.Radiobutton(self.parent, text="Menu 5", variable=tools, value=5).pack() # bottoni "Settings" e "OK": ttk.Button(self.parent, text="OK", command=self.__OpenTool).pack() # don't call __OpenTool ie remove () pass in a callable. ttk.Button(self.parent, text="Settings", command=self.__OpenSettings).pack() self.tools = tools # make tools accessable in methods def __OpenTool(self): # removed variable tools_value = self.tools.get() if tools_value == 1: print('first') # FirstWindow(self.parent) # self.parent.withdraw() elif tools_value == 2: print('2') # SecondWindow(self.parent) # self.parent.withdraw() elif tools_value == 3: print('3') # ThirdWindow(self.parent) # self.parent.withdraw() elif tools_value == 4: print('4') # FourthWindow(self.parent) # self.parent.withdraw() elif tools_value == 5: print('5') # FifthWindow(self.parent) # self.parent.withdraw() else: print("???") def __OpenSettings(self): print('open setting window') # SixthWindow(self.parent) def main(): root = Tk() app = MainWindow(root) root.mainloop() if __name__ == "__main__": main()