为什么goey checkbox函数对用户输入没有反应?

2024-05-17 17:56:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在基于google构建一个GUI,我想添加一个复选框并将值存储为True/False,但是我得到了一个错误:

IndexError: list index out of range

这是我用于复选框的代码:

import pandas as pd
from gooey import Gooey, GooeyParser

@Gooey(program_name="DEPRECIATION",navigation='TABBED', header_bg_color = '#6aa2fc',default_size=(710, 700))
def parse_args():
    parser = GooeyParser()

    parser.add_argument('Useful_Life',
                        widget='CheckBox',
                        default = False,
                        action = "store_true",
                        help='Calculate depreciation based on Useful years')
    args = parser.parse_args()
    return args

if __name__ == '__main__':
    args = parse_args()
    switch1 = args.Useful_Life
    print(switch1)

我错过什么了吗?你知道吗

引用:https://github.com/chriskiehl/Gooey/issues/148


Tags: nameimportfalsedefaultparserparsegoogleargs