Tkinter 回调变量编辑中出现异常

问题描述 投票:0回答:1
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2032.0_x64__qbz5n2kfra8p0\Lib\tkinter\__init__.py", line 1948, in __call__
    return self.func(*args)
           ^^^^^^^^^^^^^^^^
  File "c:\Users\*****\Downloads\*****\*****\builder.py", line 277, in assemble_source_code
    save_configuration()
  File "c:\Users\*****\Downloads\*****\PySilon-malware-main\builder.py", line 237, in save_configuration
    config['FUNCTIONALITY']['testing'] = str(cbvar_testing.get())
                                             ^^^^^^^^^^^^^^^^^
AttributeError: 'Checkbutton' object has no attribute 'get'

python variables tkinter
1个回答
0
投票

您似乎假设

cbvar_testing
指向
StringVar
的实例或其他变量之一(
IntVar
等),但它实际上指向
Checkbutton
的实例。由于
Checkbutton
的实例没有
get
方法,因此您会收到错误。

© www.soinside.com 2019 - 2024. All rights reserved.