Last active
February 2, 2017 20:55
-
-
Save Crowbrammer/4454aaa794725bb5af486294a546b50e 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
# File name: autopositioner.py | |
AutoPositionerRoot: | |
<MmpModule>: | |
orientation: 'vertical' | |
id: mmp1 | |
BoxLayout: # This should probably be in Root | |
id: bl_super | |
height: '90dp' | |
size_hint_y: None | |
padding: 10, 10 | |
BoxLayout: | |
id: bl1 | |
orientation: 'vertical' | |
Button: | |
Button: | |
Button: | |
BoxLayout: | |
id: bl2 | |
orientation: 'vertical' | |
Button: | |
# - - - - - | |
# The button text I'm trying to change | |
# - - - - - | |
id: machine_name | |
Button: | |
id: model_button | |
<AutoPositionerRoot>: | |
orientation: 'vertical' | |
MmpModule | |
Image: | |
source: 'data/cat.jpg' |
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
import libs.apa_database | |
import inspect | |
from kivy.app import App | |
from kivy.uix.boxlayout import BoxLayout | |
from kivy.properties import ObjectProperty, StringProperty, Property | |
#from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition | |
class AutoPositionerRoot(BoxLayout): | |
def __init__(self, **kwargs): | |
super(AutoPositionerRoot, self).__init__(**kwargs) | |
# # # # # # | |
e = MmpModule() | |
f = MmpModule() | |
e.machine_name.text = 'Wow' | |
# - - - - - | |
# Brings "AttributeError: 'str' object has no attribute 'text'" | |
# - - - - - | |
self.add_widget(e) | |
self.add_widget(f) | |
# # # # # # | |
# # # # # # | |
class MmpModule(BoxLayout): | |
machine_name = StringProperty() | |
def __init__(self, **kwargs): | |
super(MmpModule, self).__init__(**kwargs) | |
self.machine_name = 'I-34' | |
self.model_name = 'CSEG' | |
class AutopositionerApp(App): | |
def build(self): | |
AutoPositionerRoot() | |
if __name__ == '__main__': | |
AutopositionerApp().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment