This commit is contained in:
yumoqing 2021-06-29 10:23:30 +08:00
parent 4ee5c5142f
commit 9ee2a08700

View File

@ -1,6 +1,7 @@
from kivy.clock import Clock from kivy.clock import Clock
from kivy.uix.boxlayout import BoxLayout from kivy.uix.boxlayout import BoxLayout
from kivy.factory import Factory from kivy.factory import Factory
from kivy.core.window import Window
from kivyblocks.ready import WidgetReady from kivyblocks.ready import WidgetReady
@ -18,10 +19,14 @@ class TwoSides(WidgetReady, BoxLayout):
def on_size(self,*args): def on_size(self,*args):
if self.width >= self.height: if self.width >= self.height:
print('twosides.py:Window.rotation=', Window.rotation,
Window.size)
if not self.landscape_widget in self.children: if not self.landscape_widget in self.children:
self.clear_widgets() self.clear_widgets()
self.add_widget(self.landscape_widget) self.add_widget(self.landscape_widget)
else: else:
print('twosides.py:Window.rotation=', Window.rotation,
Window.size)
if not self.portrait_widget in self.children: if not self.portrait_widget in self.children:
self.clear_widgets() self.clear_widgets()
self.add_widget(self.portrait_widget) self.add_widget(self.portrait_widget)