Last active
August 29, 2015 14:22
-
-
Save Cheaterman/41f9611da649d618e4ee to your computer and use it in GitHub Desktop.
Shahriar
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
*.pyc | |
.*.sw* |
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
Small screenmanager test with multiple KVfiles and Python→KV interaction |
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
from kivy.app import App | |
from testsm import TestSM | |
class Tst(App): | |
def build(self): | |
return TestSM() | |
Tst().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
MainScreen: | |
name: 'main' | |
layout: layout | |
ScrollView: | |
GridLayout: | |
id: layout | |
size_hint_y: None | |
height: self.minimum_height | |
cols: 1 | |
spacing: 10 | |
Label: | |
text: root.string | |
font_size: '50dp' |
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
from kivy.uix.screenmanager import Screen | |
from kivy.properties import StringProperty, ObjectProperty | |
from kivy.uix.button import Button | |
class MainScreen(Screen): | |
string = StringProperty('') | |
layout = ObjectProperty(None) | |
def on_layout(self, *args): | |
layout = self.layout | |
def append_text(*args): | |
self.string += args[0].text | |
for i in range(30): | |
btn = Button(text=str(i + 1), size_hint_y=None, height=40, on_release=append_text) | |
layout.add_widget(btn) |
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
from kivy.uix.screenmanager import ScreenManager | |
from kivy.lang import Builder | |
from menu_screen import MenuScreen | |
from main_screen import MainScreen | |
class TestSM(ScreenManager): | |
def __init__(self, **kwargs): | |
super(TestSM, self).__init__(**kwargs) | |
self.add_widget(Builder.load_file('menu_screen.kv')) | |
self.add_widget(Builder.load_file('main_screen.kv')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment