I'm making a sudoku solver app. The app will let you take a picture of a sudoku, convert it to numbers in the right place in the grid and solve it.
I'm now working on the App (GUI). I make the app in kivy because it's android friendly. One of the parts of the app contains a progress bar.
For the progress bar I was thinking a widget that gets wider. I need a variable from the python script in the kivy script and if I change that variable it needs update the variable and the progress bar. How can I get a variable like that.
This is what I got now. Python Script
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition
from kivy import require
from kivy.lang import Builder
from kivy.uix.behaviors.button import ButtonBehavior
from kivy.uix.widget import Widget
from kivy.core.window import Window
from kivy.uix.floatlayout import FloatLayout
require("1.10.1")
class CameraScreen(Screen):
pass
class PictureCheckScreen(Screen):
pass
class PictureProcessingScreen(Screen):
pass
class SolveScreen(Screen):
pass
class ScreenManagement(ScreenManager):
pass
class CircularButton(ButtonBehavior, Widget):
pass
presentation = Builder.load_file("main.kv")
class MainApp(App):
def build(self):
return presentation
if __name__ == "__main__":
MainApp().run()
Kivy script
#: import Window kivy.core.window.Window
<Button>:
background_color: (0.95, 0.95, 0.95, 1.0)
ScreenManagement:
CameraScreen:
PictureCheckScreen:
# PictureProcessingScreen:
# SolveScreen:
<CameraScreen>:
name: "camera"
Widget:
Button:
text: "HOME"
size: (Window.width * .15, Window.height * .05)
pos: (Window.width * .85, Window.height * .95)
CircularButton:
background_color: (1, 0, 0, 1)
pos: (Window.width * .425, Window.height * .05)
on_release: app.root.current = "picture check"
canvas:
Color:
rgba: ((1,1,1,1) if self.state == "normal" else (.5,.5,.5,1))
Ellipse:
pos: (Window.width * .425, Window.height * .05)
size: (Window.width * .15, Window.width * .15)
<PictureCheckScreen>:
name: "picture check"
Widget:
Button:
size: (Window.width * .15, Window.width * .15)
pos: (Window.width * .15, Window.height * .05)
on_release: app.root.current = "camera"
Image:
source: "kivy/cross.png"
size: (self.parent.width * .9, self.parent.height * .9)
pos: (self.parent.x + self.parent.width * 0.05, self.parent.y + self.parent.height * 0.05)
Button:
size: (Window.width * .15, Window.width * .15)
pos: (Window.width * .7, Window.height * .05)
Image:
source: "kivy/checkmark.png"
size: (self.parent.width * .9, self.parent.height * .9)
pos: (self.parent.x + self.parent.width * 0.05, self.parent.y + self.parent.height * 0.05)
Button:
text: "HOME"
size: (Window.width * .15, Window.height * .05)
pos: (Window.width * .85, Window.height * .95)