带文本输入的Kivy错误

时间:2015-11-05 01:06:23

标签: python kivy

我正在尝试在我的电脑上运行此代码,我尝试了各种方法,但我总是得到同样的错误,我不知道该怎么做......

import kivy
kivy.require('1.0.7') 
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.codeinput import CodeInput
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
from kivy.core.window import Window
from kivy.uix.accordion import Accordion, AccordionItem

Window.clearcolor = (1, 1, 1, 1)


class Myapp(App):

    def build(self):

        self.layout = BoxLayout(padding=50,orientation="vertical",spacing=30)
        Labe_Prin = Label(text="Bienvenido al login",font_name="data/fonts/Union_soap.ttf",color=(0,0,0,0.5),font_size=50)
        Label1 = Label(text="Ingrese Usuario: ",color=(0,0,0,1),font_size=(50*0.75),bold=True,italic=False,font_name="data/fonts/English_.ttf")
        Entrada1 = TextInput(multiline = False,size_hint=(1,.3),bold=True,font_size=12.3,foreground_color=(.5,.1,.3,1),text="Usuraio",use_bubble=True) #focus=True,use_handles=True
        Label2 = Label(text="Ingrese Contrasenia: ",color=(0,0,0,1),font_size=(50*0.75),bold=True,italic=False,font_name="data/fonts/English_.ttf")
        Entrada2 = CodeInput(multiline = False,size_hint=(1,.3),italic=True,font_size=12.3,foreground_color=(.5,.1,.3,1),text="Contrasenia",use_buble=True) #Contrasenia

        def press(self):
            print Entrada1.text
            print Entrada2.text

        Boton1 = Button(size_hint=(1, .4), text='Login',on_release=press)


        self.layout.add_widget(Labe_Prin)
        self.layout.add_widget(Label1)
        self.layout.add_widget(Entrada1)
        self.layout.add_widget(Label2)
        self.layout.add_widget(Entrada2)
        self.layout.add_widget(Boton1)

        return self.layout

if __name__=="__main__":
    Myapp().run()

我有这个错误...

[CRITICAL          ] [Cutbuffer   ] Unable to find any valuable Cutbuffer provider at all!
xclip - OSError: [Errno 2] No existe el archivo o el directorio
  File "/usr/lib/python2.7/dist-packages/kivy/core/__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
  File "/usr/lib/python2.7/dist-packages/kivy/core/clipboard/clipboard_xclip.py", line 17, in <module>
p = subprocess.Popen(['xclip', '-version'], stdout=subprocess.PIPE)
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception

xsel - OSError: [Errno 2] No existe el archivo o el directorio
   File "/usr/lib/python2.7/dist-packages/kivy/core/__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
  File "/usr/lib/python2.7/dist-packages/kivy/core/clipboard/clipboard_xsel.py", line 15, in <module>
p = subprocess.Popen(['xsel'], stdout=subprocess.PIPE)
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception

我可以执行代码,但我无法构建到android

3 个答案:

答案 0 :(得分:4)

我遇到了同样的错误,但安装了xclip&amp; xsel为我修好了。

答案 1 :(得分:1)

我遇到了同样的错误。

$ sudo apt-get install xclip xsel

但是它没有帮助,因为某些基于Ubuntu的操作系统(如 Xubuntu 20.04.1 focus )没有可用的必需软件包。在这种情况下(当您出现“ E:无法找到包xclip”时),您需要使用以下包添加存储库:

$ sudo add-apt-repository universe
$ sudo add-apt-repository multiverse
$ sudo apt update
$ sudo apt-get install xclip xsel

P.S。也许您只需要 universe multiverse信息库,但我会同时安装它们。

P.S.S。这只是问题的详细答案。原因我花了大约30分钟的时间才能找到“无法找到包*”错误的解决方案。

答案 2 :(得分:0)

sudo apt-get install xclip xsel