我需要复制文本以备后用在按(ctrl + c)时,会有错误所以我使用了气泡,但出现了同样的错误
*****Python********
from kivy.app import App
from kivy.uix.popup import Popup
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.lang import Builder
class Progress(Popup):
pass
class ScreenManagement(ScreenManager):
pass
class Func(Screen):
pass
presentation = Builder.load_file("try_.kv")
class MainApp(App):
Progress = Progress()
def build(self):
return presentation
if __name__ == "__main__":
MainApp().run()
*****KV 文件********
#:import Factory kivy.factory.Factory
# #:import Clipboard kivy.core.clipboard.Clipboard
<Progress>:
text: ""
separator_color: 0, 0, 0, 0
BoxLayout:
TextInput:
id: textinput
text: "Your Key is samphone"
copydata: 'text'
readonly: True
use_bubble: True
allow_copy: True
Button:
text: "Click"
on_release:
root.dismiss()
ScreenManagement:
Func:
<Func>:
BoxLayout:
Button:
text: "Click"
on_release:
Factory.Progress().open()
****错误*****
文件“C:\Users\Sherif\AppData\Local\Programs\Python\Python35\lib\site-packages\kivy\uix\textinput.py”,第 378 行,在做 textinput.copy() 文件“C:\Users \Sherif\AppData\Local\Programs\Python\Python35\lib\site-packages\kivy\uix\textinput.py”,第 1712 行,在副本中返回 Clipboard.copy(self.selection_text) 文件“C:\Users\Sherif \AppData\Local\Programs\Python\Python35\lib\site-packages\kivy\core\clipboard__init__.py”,第 73 行,复制 self._copy(data) 文件“C:\Users\Sherif\AppData\Local\ Programs\Python\Python35\lib\site-packages\kivy\core\clipboard__init__.py",第 87 行,在 _copy self.put(data, self._clip_mime_type)
文件“C:\Users\Sherif\AppData\Local\Programs\Python\Python35\lib\site-packages\kivy\core\clipboard\clipboard_winctypes.py”,第 55 行,放入 msvcrt.wcscpy_s(c_wchar_p(hCd), len(文本),c_wchar_p(文本))
ValueError:嵌入的空字符