Tkinter GUI在试图调整风的大小时崩溃了

2024-09-27 21:30:29 发布

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

我正在尝试为一个应用程序建立一个图形用户界面,但我遇到了一个奇怪的崩溃,当我尝试调整窗口大小。在

似乎python自身正在崩溃,但我无法找到问题所在。感谢任何帮助。在

故障日志:

2018-01-26 17:20:29.424 Python[7025:727130] *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [0 nan]'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff9f95152b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00007fffb4027cad objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff9f9cfa0d +[NSException raise:format:] + 205
    3   QuartzCore                          0x00007fffa54f7980 _ZN2CA5Layer12set_positionERKNS_4Vec2IdEEb + 152
    4   QuartzCore                          0x00007fffa54f7af5 -[CALayer setPosition:] + 44
    5   QuartzCore                          0x00007fffa54f814b -[CALayer setFrame:] + 644
    6   CoreUI                              0x00007fffab2a1112 _ZN20CUICoreThemeRenderer26MakeOrUpdateScrollBarLayerEPK13CUIDescriptoraPP7CALayer + 1284
    7   CoreUI                              0x00007fffab29d317 _ZN20CUICoreThemeRenderer19CreateOrUpdateLayerEPK13CUIDescriptorPP7CALayer + 1755
    8   CoreUI                              0x00007fffab21f4d1 _ZN11CUIRenderer19CreateOrUpdateLayerEPK14__CFDictionaryPP7CALayer + 175
    9   CoreUI                              0x00007fffab222185 CUICreateOrUpdateLayer + 221
    10  AppKit                              0x00007fff9df86623 -[NSCompositeAppearance _callCoreUIWithBlock:options:] + 226
    11  AppKit                              0x00007fff9d633a9d -[NSAppearance _createOrUpdateLayer:options:] + 76
    12  AppKit                              0x00007fff9d8ac143 -[NSScrollerImp _animateToRolloverState] + 274
    13  AppKit                              0x00007fff9d86bb79 __49-[NSScrollerImp _installDelayedRolloverAnimation]_block_invoke + 673
    14  AppKit                              0x00007fff9d732331 -[NSScrollerImp _doWork:] + 15
    15  Foundation                          0x00007fffa132fc88 __NSFireDelayedPerform + 417
    16  CoreFoundation                      0x00007fff9f8d0e14 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
    17  CoreFoundation                      0x00007fff9f8d0a9f __CFRunLoopDoTimer + 1071
    18  CoreFoundation                      0x00007fff9f8d05fa __CFRunLoopDoTimers + 298
    19  CoreFoundation                      0x00007fff9f8c8021 __CFRunLoopRun + 2065
    20  CoreFoundation                      0x00007fff9f8c75b4 CFRunLoopRunSpecific + 420
    21  Tcl                                 0x0000000108db4b43 Tcl_WaitForEvent + 314
    22  Tcl                                 0x0000000108d845cd Tcl_DoOneEvent + 274
    23  _tkinter.cpython-36m-darwin.so      0x0000000108cfd760 _tkinter_tkapp_mainloop + 252
    24  Python                              0x0000000108703641 _PyCFunction_FastCallDict + 166
    25  Python                              0x0000000108767cde call_function + 489
    26  Python                              0x0000000108760b93 _PyEval_EvalFrameDefault + 4811
    27  Python                              0x0000000108768440 _PyEval_EvalCodeWithName + 1719
    28  Python                              0x0000000108768b43 fast_function + 218
    29  Python                              0x0000000108767cb5 call_function + 448
    30  Python                              0x0000000108760b93 _PyEval_EvalFrameDefault + 4811
    31  Python                              0x0000000108768440 _PyEval_EvalCodeWithName + 1719
    32  Python                              0x000000010875f84e PyEval_EvalCode + 42
    33  Python                              0x000000010878819e run_mod + 54
    34  Python                              0x00000001087871bf PyRun_FileExFlags + 160
    35  Python                              0x000000010878689c PyRun_SimpleFileExFlags + 285
    36  Python                              0x000000010879a6c0 Py_Main + 3484
    37  Python                              0x00000001086bee1d Python + 7709
    38  libdyld.dylib                       0x00007fffb4905255 start + 1
    39  ???                                 0x0000000000000002 0x0 + 2
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

下面是相关的python文件:

在主.py公司名称:

^{pr2}$

在txpellcheck.py公司名称:

^{3}$

Tags: exceptionfunctioncalltclthrowdylibcorefoundationappkit
1条回答
网友
1楼 · 发布于 2024-09-27 21:30:29

我已经解决了我的问题。在

如果其他人遇到类似的问题,这里有一个快速教程如何解决它。这就是我在MacOS10.12上的工作原理

我在python.org上找到了这个页面,它几乎概括了我遇到的问题。其中一行写道:“不要使用预装的tkinter版本”。在

快速总结一下我所做的:

  1. here下载并安装了python3.6.3版本。在
  2. here下载并安装了ActiveTcl的8.5.18.0版本。在

警告:这将删除所有全局安装的python3模块。在

有关不同MacOS版本的推荐ActiveTcl版本的列表,请参阅here。在

相关问题 更多 >

    热门问题