use*_*347 2 python tkinter function
我在 python 中创建了一个函数,我想在打开程序时运行该函数,我不想按任何东西来运行该函数。我已经尝试了很多东西,但不幸的是我还没有找到一种方法让它在启动时工作。它看起来像这样:
def check_settings():
if view_setting == "1":
view_menu.entryconfig("Change Background", state = "normal")
Run Code Online (Sandbox Code Playgroud)
假设您直接运行脚本而不是将其作为模块导入:
if __name__ == '__main__':
check_settings()
Run Code Online (Sandbox Code Playgroud)