Это часть моего проекта в последний год, мы пытаемся сделать биометрию c EVM здесь. Kivy gui кажется вполне подходящим для этой цели. Здесь есть какая-то проблема со ссылками на мой код: в нем либо есть ошибка «WeakProxy» или «WeakRef», либо «ошибка этого объекта в ошибке». Я новичок в этом коде, кто-то может посмотреть на код? @ te c
Код Python
import kivy
kivy.require('1.0.6')
from kivy.app import App
#from kivy.uix.widget import Widget
from kivy.properties import ObjectProperty
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.lang import Builder
# Screen loaders
class StartWindow(Screen):
pass
class InstWindow(Screen):
btn = ObjectProperty(None)
def on_enter(self):
self.btn()
def btn(self):
self.btn.opacity= 0.8
for x in range(0,1000):
pass
self.btn.opacity = 1
pass
class VoteWindow(Screen):
pass
class AckWindow(Screen):
pass
###############################################################################
class WindowManager(ScreenManager):
pass
kv = Builder.load_file("mainvp.kv")
sm = WindowManager()
screens = [StartWindow(name="start"), InstWindow(name="instructions"),VoteWindow(name="vote"),AckWindow(name="acknowledgement")]
for screen in screens:
sm.add_widget(screen)
sm.current = "start"
class MainVpApp(App):
def build(self):
return sm
if __name__ == '__main__':
MainVpApp().run()
Киви Ланг
<StartWindow>
name: "start"
FloatLayout:
cols: 1
Label:
pos_hint:{"x":0.31,"top":0.7}
size_hint: 0.35, 0.2
font_size: (root.width**2 + root.height**2) / 11.5**4
text: "WELCOME"
Button:
pos_hint:{"x":0.3,"y":0.25}
size_hint: 0.3, 0.08
font_size: (root.width**2 + root.height**2) / 16**4
text: "Next to instructions"
on_release:
root.manager.transition.direction = "left"
app.root.current = "instructions"
<InstWindow>
name: "instructions"
on_enter: root.btn()
btn : btn
FloatLayout:
Label:
pos_hint:{"x":0.3,"top":1}
size_hint: 0.35, 0.2
font_size: (root.width**2 + root.height**2) / 12**4
text: "Instructions"
Label:
pos_hint:{"x":0.08,"top":0.8}
size_hint: 0.2, 0.1
font_size: (root.width**2 + root.height**2) / 15**4
text: " 1. Put your fingure on scanner \n 2. Wait for authentication \n 3. Click the button to proceed "
Button:
id: btn
pos_hint:{"x":0.3,"y":0.25}
size_hint: 0.4, 0.1
font_size: (root.width**2 + root.height**2) / 14**4
background_color: 0,1,0,0.8
text: "Next to vote"
on_release:
root.manager.transition.direction = "left"
app.root.current = "vote"
<VoteWindow>
name: "vote"
FloatLayout:
Button:
pos_hint:{"x":0.3,"y":0.25}
size_hint: 0.4, 0.1
font_size: (root.width**2 + root.height**2) / 17**4
text: "Next to acknowledge"
on_release:
root.manager.transition.direction = "left"
app.root.current = "acknowledgement"
<AckWindow>
name: "acknowledgement"
FloatLayout:
Button:
pos_hint:{"x":0.3,"y":0.25}
size_hint: 0.4, 0.1
font_size: (root.width**2 + root.height**2) / 17**4
text: "back to start"
on_release:
root.manager.transition.direction = "left"
app.root.current = "start"
Ошибка
Файл "C: \ Users \ HP \ Anaconda3 \ lib \ site-packages \ kivy \ lang \ builder.py", строка 64, в custom_callback exe c ( kvlang .co_value, idmap)
Файл "C: \ Users \ HP \ Desktop \ FYP \ gui \ mainvp.kv", строка 25, в on_enter: root .btn ()
Ошибка типа: объект 'kivy.weakproxy.WeakProxy' не вызывается