title: Using Kivy, how do I have a checkbox's active (or inactive) status rotate (or not rotate) an image on the second screen?
body: <p>On the first screen, I have a checkbox that asks the user if they want their image in landscape mode. On the second screen, my code currently uses a <code>canvas</code> and rotates the image 90 degrees. If that box is not checked, that means the user wants the image to be portrait mode, and I need that canvas to be cleared.</p>
  <p>my.kv</p>
  <pre><code>WindowManager:
      MainWindow:
      SecondWindow:
  
  &lt;MainWindow&gt;:
      id: main_window
      name: &quot;main&quot;
  
      BoxLayout:
          orientation: &quot;vertical&quot;
          size: root.width, root.height
          padding: 50
  
          Label:
              text: &quot;Email&quot;
              color: 0,0,0,1
              font_size: 32
  
          BoxLayout:
              orientation: &quot;horizontal&quot;
              Label:
                  text: &quot;Email Address:&quot;
                  color: 0,0,0,1
  
              TextInput:
                  size_hint_y: None
                  pos_hint: {'center_y': .5}
                  height: 38
                  multiline: True
                  padding: 10
  
          BoxLayout:
              orientation: &quot;horizontal&quot;
  
              Label:
                  text: &quot;Display Landscape Mode?&quot;
                  color: 0,0,0,1
              CheckBox:
                  id: checkbox_confirm_mode
                  on_active:
                      root.checkbox_click_mode(self, self.active)
                  pos_hint: {'center_x': .5}
  
          BoxLayout:
              orientation: &quot;horizontal&quot;
  
              Label:
                  text: &quot;Stretch image to fill screen?&quot;
                  color: 0,0,0,1
              CheckBox:
                  id: checkbox_confirm_stretch
                  on_active:
                      root.checkbox_click_stretch(self, self.active)
                  pos_hint: {'center_x': .5}
  
          BoxLayout:
              orientation: &quot;horizontal&quot;
  
              Label:
                  text: &quot;I double-checked that my email is typed correctly:&quot;
                  color: 0,0,0,1
              CheckBox:
                  id: checkbox_confirm_email
                  on_active:
                      root.checkbox_click(self, self.active)
                      root.disable_button()
                  pos_hint: {'center_x': .5}
  
          BoxLayout
              orientation: &quot;vertical&quot;
  
              Button:
                  id:submit_button
                  text: &quot;Submit&quot;
                  disabled: True
                  size_hint: (0.2, None)
                  pos_hint: {'center_x': .5}
                  height: 50
  
                  on_release:
                      app.root.current = &quot;second&quot;
                      root.manager.transition.direction = &quot;left&quot;
  
  &lt;SecondWindow&gt;:
      id: second_window
      name: &quot;second&quot;
      canvas:
          Rotate:
              angle: 90
              origin: self.center
  
      Image:
          source: 'Troy.png'
          keep_ratio: True
          allow_stretch: False
  
  </code></pre>
  <p>main.py</p>
  <pre><code>from kivy.app import App
  from kivy.lang import Builder
  from kivy.uix.screenmanager import ScreenManager, Screen
  from kivy.core.window import Window
  from kivy.properties import ObjectProperty
  from kivy.config import Config
  Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
  
  
  class MainWindow(Screen):
      def on_pre_enter(self):
          Window.size = (750,400)
          Window.clearcolor = (1, 1, 1, 1)
  
      def checkbox_click(self, instance, value):
          return value
  
      def checkbox_click_mode(self, instance, value):
          return value
  
      def checkbox_click_stretch(self, instance, value):
          return value
  
      def clear_canvas(self):
          self.canvas.clear()
          return
  
      def disable_button(self):
          if self.ids.checkbox_confirm_email.active == False:
              self.ids.submit_button.disabled = True
          else:
              self.ids.submit_button.disabled = False
  
  
  class SecondWindow(Screen):
      def on_pre_enter(self):
          Window.size = (500,500)
          Window.clearcolor = (0,0,0,0)
      pass
  
  class WindowManager(ScreenManager):
      pass
  
  class MyMainApp(App):
      def build(self):
          return kv
  
  kv = Builder.load_file(&quot;my.kv&quot;)
  
  if __name__ == &quot;__main__&quot;:
      MyMainApp().run()
  </code></pre>