Skip to content

Instantly share code, notes, and snippets.

@inclement
Created June 30, 2018 15:09
Show Gist options
  • Select an option

  • Save inclement/d546233aee11e2837512e1675f030ea4 to your computer and use it in GitHub Desktop.

Select an option

Save inclement/d546233aee11e2837512e1675f030ea4 to your computer and use it in GitHub Desktop.
import kivy
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
import socket
import json
class VideoScreen(GridLayout):
def __init__(self, **kwargs):
super(VideoScreen, self).__init__(**kwargs)
self.cols = 1
myText = "Current Status: Idle"
self.statusInfo = Label(text=myText, markup=True)
self.add_widget(self.statusInfo)
btnStartVideo = Button(text="Turn On")
btnStartVideo.bind(on_press=streamVideo)
self.add_widget(btnStartVideo)
btnEndVideo = Button(text="Turn Off")
btnEndVideo.bind(on_press=endVideo)
self.add_widget(btnEndVideo)
def streamVideo(instance):
print("Turning On")
myText = "Turning On"
self.statusInfo.text=myText
def endVideo(instance):
print("Turning Off")
myText = "Turning Off"
self.statusInfo.text=myText
class MyApp(App):
def build(self):
return VideoScreen()
if __name__ == '__main__':
MyApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment