小编Rak*_*oob的帖子

无法在 Kivy 主线程之外创建图形指令

我正在尝试用 kivy 创建一个小型 GUI。通过单击名为“button”的按钮,它应该在另一个线程上启动弹出窗口,并在 3 秒后显示进度条。但是 kivy 给我一个错误,说“无法在主 Kivy 线程之外创建图形指令”如何解决这个问题?

 from kivy.app import App 
 from kivy.uix.label import Label
 from kivy.uix.progressbar import ProgressBar
 from kivy.uix.boxlayout import BoxLayout
 from kivy.uix.button import Button
 from kivy.uix.popup import Popup
 from kivy.lang import Builder

 import time
 import threading

 Builder.load_string(""" 

 <Interface>:

     orientation: 'vertical'
     Label:
       text: "Test"

  BoxLayout:
      orientation: 'vertical'
      Label
        text: "phone Number"

      TextInput:
          id: variable
          hint_text: ""
      Thebutton:
          user_input: variable.text
          text: "Buttion"
          on_release: self.do_action()

""")


class Interface(BoxLayout):
    pass


class Thebutton(Button):

    def bar_de_progress(self):
        bdp = ProgressBar()
        poo …
Run Code Online (Sandbox Code Playgroud)

python kivy

5
推荐指数
1
解决办法
3839
查看次数

标签 统计

kivy ×1

python ×1