Created
October 30, 2014 18:49
-
-
Save kashifpk/3cfce1c88288c70c8637 to your computer and use it in GitHub Desktop.
Kivy Window.on_rotate issue
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
import kivy | |
kivy.require('1.8.0') | |
from kivy.app import App | |
from kivy.core.window import Window | |
from kivy.uix.textinput import TextInput | |
from kivy.uix.boxlayout import BoxLayout | |
from kivy.properties import ListProperty, ObjectProperty | |
class MainWindow(BoxLayout): | |
"Main screen of the app" | |
def do_action(self, action): | |
"Called for good or bad button presses" | |
self.set_status(action) | |
print(Window.size) | |
self.orientation = 'vertical' | |
def set_status(self, msg): | |
self.lbl_status.text = msg | |
class GoodOrBadApp(App): | |
"The main app" | |
main_window = None | |
def rotate_screen(self, rotation): | |
print(rotation) | |
self.main_window.set_status(rotation) | |
def build(self): | |
print(Window.size) | |
Window.on_rotate(self.rotate_screen) | |
self.main_window = MainWindow() | |
return self.main_window | |
if __name__ == '__main__': | |
GoodOrBadApp().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment