Last active
March 10, 2017 15:00
-
-
Save ilovetogetspamed/cf89ed5fcd4932b3a601f570d7b7fa64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
import kivy | |
kivy.require('1.9.1') | |
from kivy.config import Config | |
# Adjust for RasPi touch screen size and no keyboard | |
Config.set('graphics', 'width', '800') | |
Config.set('graphics', 'height', '480') | |
# Config.set('kivy', 'keyboard_mode', 'systemanddock') | |
from kivy.app import App | |
from kivy.parser import parse_color as h2c | |
from kivy.uix.boxlayout import BoxLayout | |
from kivy.properties import NumericProperty | |
from kivy.logger import Logger | |
from kivy.clock import Clock, mainthread | |
class ButtonFocusForm(BoxLayout): | |
def _refocus_position_box(self, arg1): | |
self.ids['position_box'].text = '0' | |
self.ids['position_box'].select_all() | |
self.ids['position_box'].focus = True | |
def set_position(self, position): | |
if not position.isdigit(): | |
Logger.warning('ButtonFocusForm: set_position: Invalid position given!') | |
# return | |
else: | |
Logger.info('ButtonFocusForm: set_position: You entered a number!') | |
Clock.schedule_once(self._refocus_position_box, 0) | |
class ButtonFocusRoot(BoxLayout): | |
# used for interacting with the system configuration | |
use_kivy_settings = False # disable the Kivy configuration settings panel | |
position = NumericProperty() | |
class ButtonFocusApp(App): | |
pass | |
if __name__ == '__main__': | |
ButtonFocusApp().run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
import kivy | |
kivy.require('1.9.1') | |
from kivy.config import Config | |
# Adjust for RasPi touch screen size and no keyboard | |
Config.set('graphics', 'width', '800') | |
Config.set('graphics', 'height', '480') | |
# Config.set('kivy', 'keyboard_mode', 'systemanddock') | |
from kivy.app import App | |
from kivy.parser import parse_color as h2c | |
from kivy.uix.boxlayout import BoxLayout | |
from kivy.properties import NumericProperty | |
from kivy.logger import Logger | |
from kivy.clock import Clock, mainthread | |
from kivy.uix.textinput import TextInput | |
class MyTextInput(TextInput): | |
def on_parent(self, widget, parent): | |
self.focus = True | |
class ButtonFocusForm(BoxLayout): | |
def _refocus_position_box(self, arg1): | |
self.ids['position_box'].text = '0' | |
self.ids['position_box'].select_all() | |
self.ids['position_box'].focus = True | |
def set_position(self, position): | |
if not position.isdigit(): | |
Logger.warning('ButtonFocusForm: set_position: Invalid position given!') | |
# return | |
else: | |
Logger.info('ButtonFocusForm: set_position: You entered a number!') | |
Clock.schedule_once(self._refocus_position_box, 0) | |
class ButtonFocusRoot(BoxLayout): | |
# used for interacting with the system configuration | |
use_kivy_settings = False # disable the Kivy configuration settings panel | |
position = NumericProperty() | |
class ButtonFocusApp(App): | |
pass | |
if __name__ == '__main__': | |
ButtonFocusApp().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment