用Macbook-苹果系统写代码出现显示问题Text input context does not respond to _valueForTIProperty:

在Mac系统使用Python写代码,有GUI显示界面时点击该界面会报错。源代码为读取并显示图片,报错主要信息表明中文输入法下点击GUI会出错,将输入法切换成英文输入即可解决问题,还给出了英文回答及解决步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Macbook / 苹果系统写代码出现显示问题

当使用Mac系统,在写代码的时候,如果是有一个GUI显示界面,然后你又去点击这个界面。此时,将报错。
我的源代码,是读取图片,显示图片。

import cv2 as cv
pic = cv.imread("test.jpeg")
dst = cv.resize(pic, (512, 512))
cv.imshow("This is the test pic!", dst)
cv.waitKey(5000)

报错信息如下:

2021-01-10 19:54:02.332 python[8857:163844] _TIPropertyValueIsValid called with 4 on nil context!
2021-01-10 19:54:02.332 python[8857:163844] imkxpc_getApplicationProperty:reply: called with incorrect property value 4, bailing.
2021-01-10 19:54:02.332 python[8857:163844] Text input context does not respond to _valueForTIProperty:
2021-01-10 19:54:02.334 python[8857:163844] _TIPropertyValueIsValid called with 4 on nil context!
2021-01-10 19:54:02.334 python[8857:163844] imkxpc_getApplicationProperty:reply: called with incorrect property value 4, bailing.
2021-01-10 19:54:02.334 python[8857:163844] Text input context does not respond to _valueForTIProperty:
2021-01-10 19:54:02.344 python[8857:163844] _TIPropertyValueIsValid called with 4 on nil context!
2021-01-10 19:54:02.344 python[8857:163844] imkxpc_getApplicationProperty:reply: called with incorrect property value 4, bailing.
2021-01-10 19:54:02.344 python[8857:163844] Text input context does not respond to _valueForTIProperty:
2021-01-10 19:54:04.070 python[8857:163844] _TIPropertyValueIsValid called with 4 on nil context!
2021-01-10 19:54:04.070 python[8857:163844] imkxpc_getApplicationProperty:reply: called with incorrect property value 4, bailing.
2021-01-10 19:54:04.070 python[8857:163844] Text input context does not respond to _valueForTIProperty:
2021-01-10 19:54:04.087 python[8857:163844] _TIPropertyValueIsValid called with 4 on nil context!
2021-01-10 19:54:04.087 python[8857:163844] imkxpc_getApplicationProperty:reply: called with incorrect property value 4, bailing.
2021-01-10 19:54:04.087 python[8857:163844] Text input context does not respond to _valueForTIProperty:

在这里插入图片描述

报错的主要信息是:
2021-01-10 19:54:04.087 python[8857:163844] Text input context does not respond to _valueForTIProperty:

这表明你现在的输入法,是中文,然后点击这个GUI,就出现这个错误。需要将你的输入法切换成英文输入即可解决这个问题。

下面是英文的回答:

This problem is not related to the Swift code at all. I code the Swift application with Japanese input source on macOS because my keyboard layout is Japanese, hence the error messages are shown on Terminal/console when the application window get/lost focus.
Changing the Input Sources to English - ABC solves the problem. You can change the Input Sources from macOS System Preferences - Keyboard. Add or change the Input Source to English - ABC from Input Sources tab.

如果有用,记得点赞👍加收藏哦。!!!!

评论 16
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值