【问题标题】:ValueError: ['text_font'] are not supported arguments. Look at the documentation for supported argumentsValueError:[\'text_font\'] 不是受支持的参数。查看支持参数的文档
【发布时间】:2022-12-17 07:26:30
【问题描述】:

ValueError:['text_font'] 不是受支持的参数。查看支持参数的文档。 当我尝试在 visual studio 上为 python 语言运行我的 GUI 时显示以下错误

我正在使用 Windows 11

【问题讨论】:

  • 请编辑您的问题并包括您正在运行的代码,该代码有此错误。现在,没有代码,甚至没有指示您正在使用哪些包可能会产生该错误,根本无法帮助您。
  • 请阐明您的具体问题或提供更多详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: python user-interface


【解决方案1】:

对于用户 sara Alqahtani,我对这个问题有更多的解释>> 因为我遇到了同样的错误,但没有解决方案。希望有人能解决。

我最近将 customtkinter 升级到最新版本,比如 5.0 我使用 pyinstaller 将 python 脚本文件打包到一个可执行的 exe 文件中,代码如下:

pyinstaller --noconfirm --onedir --windowed --add-data "c:userspccppdatalocalprogramspythonpython310libsite-packages/customtkinter;customtkinter/"  "main.py"

这段代码,我的意思是 exe 文件,在升级 customtkinter 之前工作正常,我使用的是 customtkinter 4.0 之类的版本

所以升级后会抛出这个错误:

 Failed to execute script "main" due to unhandled exception: ['text_font'] are not supported arguments. Look at the documentation for supported arguments

Traceback (most recent call last):
  File "main.py", line 1161, in <module>
  File "main.py", line 101, in __init__
  File "customtkinterwindowswidgetsctk_label.py", line 90, in __init__
    check_kwargs_empty(kwargs, raise_error=True)
  File "customtkinterwindowswidgetsutilityutility_functions.py", line 18, in check_kwargs_empty
    raise ValueError(f"{list(kwargs_dict.keys())} are not supported arguments. Look at the documentation for supported arguments.")
ValueError: ['text_font'] are not supported arguments. Look at the documentation for supported arguments.

【讨论】:

    【解决方案2】:

    我正在更新一个旧的 gui,所以我去了 customtkinter。我得到了同样的错误。文档确实说 text_font=("abc", 12)。但是当你查看模块时,有参数“字体”,请改用它:

    self.label = customtkinter.CTkLabel(master=self.frame, text="your_text", font=("Roboto", 24))

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-23
      • 2012-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多