I have this simple program for displaying text on a screen using python and kivy but I cannot get my screen to update. I have tried using what is written below but it keeps crashing with the error 'segmentation fault'. I believe the issue my be caused by the def _init_ because if I remove it the fault goes away but the screen still does not update.
class ScreenDivider(Widget):
def __init__(self):
self.score = 12
#Clock.schedule_interval(self.UpdateText,1) I tried using this way but no luck
def UpdateText(self, dt):
self.score += 1
class Screen(App):
####################### Ignore from here ##################
stocksSearchArray = GrabStockList() # Grab the list of stocks I want to see
global stocksOnScreen # List of the stocks currently displayed on LED screen
global stocksOnScreenListInfo # The quote information for the stocks on screen
stocksOnScreen = []
stocksOnScreenListInfo = []
# Thread to handle constant data collection
thread_data_collector = threading.Thread(target=dataCollector_thread)
thread_data_collector.daemon = True
thread_data_collector.start()
# Thread to handle screen update
thread_whatsonscreen = threading.Thread(target=screenUpdate_thread, args=(stocksSearchArray,))
thread_whatsonscreen.daemon = True
thread_whatsonscreen.start()
# Handle user input
thread_inputHandle = threading.Thread(target=userInput_thread, args=(stocksSearchArray,))
thread_inputHandle.daemon = True
thread_inputHandle.start()
####################### Ignore to here ##################
# Build the screen
def build(self):
screen = ScreenDivider()
Clock.schedule_interval(screen.UpdateText, 1.0 / 60.0)
return screen
if __name__ == "__main__":
Screen().run()
The .ky file
#:kivy 1.0.9
<ScreenDivider>:
name: 'program'
canvas:
Line:
points: 0,root.height*0.2,root.width,root.height*0.2
Label:
font_size: 70
center_x: root.width / 4
top: root.top - 50
text: str(root.score)