我在所有函数中都有self
,但标题中仍然存在错误。我不知道该怎么办,有什么帮助吗
代码如下:
class layy(App):
global t
t = TextInput(hint_text='insert text')
global c
global s
s = TextInput(hint_text='insert time till begin')
c = TextInput(hint_text='insert amount')
def bott(self):
am = c.text
if (am == ""):
am = '0'
l = int(am)
pm = c.text
if (pm == ""):
pm = '0'
o = int(pm)
base = 0
time.sleep(o)
while (base < l):
pyautogui.typewrite(t)
pyautogui.press('enter')
base = base + 1
def build(self):
b = Button(text = 'Start Spam')
b.bind(on_press = self.bott)
layout = BoxLayout(orientation='vertical')
sublay1 = BoxLayout(orientation='horizontal')
sublay2 = BoxLayout(orientation='horizontal')
sublay3 = BoxLayout(orientation='horizontal')
layout.add_widget(sublay1)
sublay1.add_widget(t)
layout.add_widget(sublay2)
sublay2.add_widget(s)
sublay2.add_widget(c)
layout.add_widget(sublay3)
sublay3.add_widget(b)
return layout
if __name__ == '__main__':
layy().run()
如果需要更多的信息,这应该是重复发送所需的文本多次我需要。如果有人知道该做什么,请告诉我
Kivy事件处理程序可以接受任意数量的参数。我还没有找到为每个回调类型提供哪些参数的好的源代码,但是Button有一个使用
on_press
的示例,它接收正在按下的按钮实例。这是错误引用的第二个神秘参数。只需将其添加到您的方法中即可相关问题 更多 >
编程相关推荐